• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OWLOntologyID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLOntologyID的典型用法代码示例。如果您正苦于以下问题:Java OWLOntologyID类的具体用法?Java OWLOntologyID怎么用?Java OWLOntologyID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OWLOntologyID类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLOntologyID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getListCellRendererComponent

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {

	super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

	if (value instanceof OWLOntology) {
		OWLOntologyID id = ((OWLOntology) value).getOntologyID();
		if (id.isAnonymous()) {
			this.setText(id.toString());
		} else {
			this.setText(id.getOntologyIRI().get().toString());
		}
	}

	return this;
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:18,代码来源:UelUI.java


示例2: translate

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Translate the given {@link GafDocument} into an OWL representation of the LEGO model.
 * 
 * @param gaf
 * @return lego ontology
 * @throws OWLException
 * @throws UnknownIdentifierException 
 */
public OWLOntology translate(GafDocument gaf) throws OWLException, UnknownIdentifierException {
	final OWLOntologyManager m = graph.getManager();
	OWLOntology lego = m.createOntology(IRI.generateDocumentIRI());
	OWLOntology sourceOntology = graph.getSourceOntology();
	OWLOntologyID ontologyID = sourceOntology.getOntologyID();
	if (ontologyID != null) {
		Optional<IRI> ontologyIRI = ontologyID.getOntologyIRI();
		if (ontologyIRI.isPresent()) {
			OWLDataFactory f = m.getOWLDataFactory();
			OWLImportsDeclaration importDeclaration = f.getOWLImportsDeclaration(ontologyIRI.get());
			m.applyChange(new AddImport(lego, importDeclaration ));
		}
	}
	translate(gaf.getGeneAnnotations(), lego);
	return lego;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:25,代码来源:GafToLegoIndividualTranslator.java


示例3: createOWLOntologyManager

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
public static OWLOntologyManager createOWLOntologyManager() {
	OWLOntologyManager man = new OWLOntologyManagerImpl(df,
			new NoOpReadWriteLock());
	man.getOntologyFactories()
			.set(new OWLOntologyFactoryImpl(new OWLOntologyBuilder() {
				private static final long serialVersionUID = -7962454739789851685L;

				@Override
				public OWLOntology createOWLOntology(OWLOntologyManager om,
						OWLOntologyID id) {
					return new OWLOntologyImpl(om, id);
				}
			}));
	man.getOntologyParsers().set(MASTER_MANAGER_.getOntologyParsers());
	man.getOntologyStorers().set(MASTER_MANAGER_.getOntologyStorers());
	man.getIRIMappers().set(MASTER_MANAGER_.getIRIMappers());
	return man;
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:19,代码来源:TestOWLManager.java


示例4: OntologyMetadata

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
public OntologyMetadata(OWLOntology ont) {
	super();
	OWLOntologyID id = ont.getOntologyID();
	if (id.getOntologyIRI().isPresent())
		ontologyIRI = id.getOntologyIRI().get().toString();
	if (id.getVersionIRI().isPresent())
		versionIRI = id.getVersionIRI().get().toString();
	importDirectives = new HashSet<String>();
	for (OWLImportsDeclaration oid : ont.getImportsDeclarations()) {
		importDirectives.add(oid.getIRI().toString());
	}
	classCount = ont.getClassesInSignature().size();
	namedIndividualCount = ont.getIndividualsInSignature().size();
	axiomCount = ont.getAxiomCount();
	annotations = new HashSet<OntologyAnnotation>();
	for (OWLAnnotation ann : ont.getAnnotations()) {
		annotations.add(new OntologyAnnotation(ann));
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OntologyMetadata.java


示例5: handleVersion

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
private String handleVersion(String ontologyId) {
	// TODO add an option to set/overwrite the version manually via command-line
	// TODO re-use/create a method in obo2owl for creating an version IRI
	String version;
	OWLOntology ontology = mooncat.getOntology();
	OWLOntologyID owlOntologyId = ontology.getOntologyID();
	Optional<IRI> versionIRI = owlOntologyId.getVersionIRI();
	if (versionIRI.isPresent() == false) {
		// set a new version IRI using the current date
		version = OntologyVersionTools.format(new Date());
		versionIRI = Optional.of(IRI.create(Obo2OWLConstants.DEFAULT_IRI_PREFIX+ontologyId+"/"+oortConfig.getVersionSubdirectory()+"/"+version+"/"+ontologyId+".owl"));
		
		OWLOntologyManager m = mooncat.getManager();
		m.applyChange(new SetOntologyID(ontology, new OWLOntologyID(owlOntologyId.getOntologyIRI(), versionIRI)));
	}
	else {
		String versionIRIString = versionIRI.get().toString();
		version = OntologyVersionTools.parseVersion(versionIRIString);
		if (version == null) {
			// use the whole IRI? escape?
			logError("Could not parse a version from ontolgy version IRI: "+versionIRIString);
			version = versionIRIString;
		}
	}
	return version;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:OboOntologyReleaseRunner.java


示例6: visit

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
@Override
public Void visit(OWLOntology ontology) {
  this.ontology = Optional.of(ontology);
  this.definingOntology = OwlApiUtils.getIri(ontology);
  Long versionNodeID = null;
  Long ontologyNodeID = null;
  OWLOntologyID id = ontology.getOntologyID();
  if (null == id.getOntologyIRI()) {
    logger.fine("Ignoring null ontology ID for " + ontology.toString());
  } else {
    ontologyNodeID = getOrCreateNode(id.getOntologyIRI().toString(), OwlLabels.OWL_ONTOLOGY);
  }
  if (null != id.getVersionIRI()){
    versionNodeID = getOrCreateNode(id.getVersionIRI().toString(), OwlLabels.OWL_ONTOLOGY);
  }
  if (null != ontologyNodeID && null != versionNodeID) {
    graph.createRelationship(ontologyNodeID, versionNodeID, OwlRelationships.OWL_VERSION_IRI);
  }
  return null;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:21,代码来源:GraphOwlVisitor.java


示例7: getOntologyAnnotationsOrderedByOntology

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
public Map<String, Set<OWLAnnotationValue>> getOntologyAnnotationsOrderedByOntology(
		String annotation) {
	Map<String, Set<OWLAnnotationValue>> annotationValuesByOntologyIri = new HashMap<String, Set<OWLAnnotationValue>>();
	final OWLDataFactory factory = manager.getOWLDataFactory();
	final OWLAnnotationProperty dcProperty = factory
			.getOWLAnnotationProperty(IRI.create(annotation));
	for (OWLOntology ontology : manager.getOntologies()) {

		Set<OWLAnnotationValue> annotationValues = new HashSet<OWLAnnotationValue>();
		for (OWLAnnotation owlAnnotation : ontology.getAnnotations()) {
			if (owlAnnotation.getProperty().equals(dcProperty)) {
				annotationValues.add(owlAnnotation.getValue());
			}
		}

		if (!annotationValues.isEmpty()) {
			final OWLOntologyID ontologyID = ontology.getOntologyID();

			annotationValuesByOntologyIri.put(ontologyID.getOntologyIRI()
					.toString(), annotationValues);
		}

	}
	return annotationValuesByOntologyIri;
}
 
开发者ID:edlectrico,项目名称:Pellet4Android,代码行数:26,代码来源:OntologyManager.java


示例8: getRuns

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
public List<OntologyChangeRecordRun> getRuns() {
    List<OntologyChangeRecordRun> result = new ArrayList<OntologyChangeRecordRun>();
    if (!changeRecords.isEmpty()) {
        OWLOntologyID currentRunId = null;
        List<OWLOntologyChangeData> runInfoList = new ArrayList<OWLOntologyChangeData>();
        for(OWLOntologyChangeRecord record : changeRecords) {
            if(currentRunId == null) {
                // First run
                currentRunId = record.getOntologyID();
            }
            else if(!currentRunId.equals(record.getOntologyID())) {
                // Store current run
                result.add(new OntologyChangeRecordRun(currentRunId, new ArrayList<OWLOntologyChangeData>(runInfoList)));
                // Reset for fresh run
                currentRunId = record.getOntologyID();
                runInfoList.clear();
            }
            // Add to current run
            runInfoList.add(record.getData());
        }
        result.add(new OntologyChangeRecordRun(currentRunId, new ArrayList<OWLOntologyChangeData>(runInfoList)));
    }
    return result;
}
 
开发者ID:matthewhorridge,项目名称:binaryowl,代码行数:25,代码来源:OntologyChangeRecordList.java


示例9: createOntology

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
@Override
public OWLOntology createOntology() {
	try {
		return modelManager.createNewOntology(new OWLOntologyID(), null);
	} catch (OWLOntologyCreationException ex) {
		throw new RuntimeException(ex);
	}
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:9,代码来源:UelProtegeStarter.java


示例10: getTboxIRI

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Executed before the init call {@link #init()}.
 * 
 * @param graph
 * @return IRI, never null
 * @throws OWLOntologyCreationException
 */
protected IRI getTboxIRI(OWLGraphWrapper graph) throws OWLOntologyCreationException {
	OWLOntology tbox = graph.getSourceOntology();
	OWLOntologyID ontologyID = tbox.getOntologyID();
	if (ontologyID != null) {
		Optional<IRI> ontologyIRI = ontologyID.getOntologyIRI();
		if (ontologyIRI.isPresent()) {
			return ontologyIRI.get();
		}
	}
	throw new OWLOntologyCreationException("No ontology id available for tbox. An ontology IRI is required for the import into the abox.");
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:CoreMolecularModelManager.java


示例11: exportModel

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Export the ABox, will try to set the ontologyID to the given modelId (to
 * ensure import assumptions are met)
 * 
 * @param model
 * @param ontologyFormat
 * @return modelContent
 * @throws OWLOntologyStorageException
 */
public String exportModel(ModelContainer model, OWLDocumentFormat ontologyFormat) throws OWLOntologyStorageException {
	final OWLOntology aBox = model.getAboxOntology();
	final OWLOntologyManager manager = aBox.getOWLOntologyManager();
	
	// make sure the exported ontology has an ontologyId and that it maps to the modelId
	final IRI expectedABoxIRI = model.getModelId();
	Optional<IRI> currentABoxIRI = aBox.getOntologyID().getOntologyIRI();
	if (currentABoxIRI.isPresent() == false) {
		manager.applyChange(new SetOntologyID(aBox, expectedABoxIRI));
	}
	else {
		if (expectedABoxIRI.equals(currentABoxIRI) == false) {
			OWLOntologyID ontologyID = new OWLOntologyID(Optional.of(expectedABoxIRI), Optional.of(expectedABoxIRI));
			manager.applyChange(new SetOntologyID(aBox, ontologyID));
		}
	}

	// write the model into a buffer
	ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
	if (ontologyFormat != null) {
		manager.saveOntology(aBox, ontologyFormat, outputStream);
	}
	else {
		manager.saveOntology(aBox, outputStream);
	}
	
	// extract the string from the buffer
	String modelString = outputStream.toString();
	return modelString;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:40,代码来源:CoreMolecularModelManager.java


示例12: appendOntologyId

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
private void appendOntologyId(OWLOntologyID ontologyID, StringBuilder sb) {
	Optional<IRI> ontologyIRI = ontologyID.getOntologyIRI();
	if (ontologyIRI.isPresent()) {
		sb.append("Ontology(id=").append(ontologyIRI.get());
		Optional<IRI> versionIRI = ontologyID.getVersionIRI();
		if (versionIRI .isPresent()) {
			sb.append(", version=").append(versionIRI.get());
		}
		sb.append(")");
		
	}
	else {
		sb.append("Ontology with no ID");
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:16,代码来源:BioChebiGenerator.java


示例13: EcoTools

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Create an instance for the given graph and reasoner.
 * 
 * @param graph
 * @param reasoner
 * @param disposeReasoner set to true, if the reasoner should also be disposed
 * @throws UnknownOWLOntologyException
 * @throws OWLOntologyCreationException
 * 
 * @see #dispose()
 */
public EcoTools (OWLGraphWrapper graph, OWLReasoner reasoner, boolean disposeReasoner) throws UnknownOWLOntologyException, OWLOntologyCreationException {

	// This has bitten me, so let's try and bew specific...
	if( reasoner == null ){ throw new Error("No reasoner was specified for use with the EcoTools. Add a reasoner for the command line"); }
	
	// assume the graph wrapper is more than eco
	// try to find ECO by its purl
	Set<OWLOntology> allOntologies = graph.getAllOntologies();
	OWLOntology eco = null;
	for (OWLOntology owlOntology : allOntologies) {
		OWLOntologyID id = owlOntology.getOntologyID();
		Optional<IRI> ontologyIRI = id.getOntologyIRI();
		if (ontologyIRI.isPresent()) {
			if (ECO_PURL.equals(ontologyIRI.get().toString())) {
				eco = owlOntology;
			}
		}
	}
	if (eco != null) {
		// found eco create new wrapper
		this.eco = new OWLGraphWrapper(eco);
	}
	else {
		// did not find eco, use whole wrapper
		this.eco = graph;
	}
	
	this.reasoner = reasoner;
	this.disposeReasonerP = disposeReasoner;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:EcoTools.java


示例14: createTraversingEcoMapper

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Create a {@link TraversingEcoMapper} instance using the given
 * {@link OWLGraphWrapper}. It is assumed that ECO can be retrieved from the
 * graph using its default IRI. The mappings are retrieved using the PURL.
 * <p>
 * Uses the given reasoner in the traversal methods. If disposeReasoner is
 * set to true, dispose also the reasoner, while calling
 * {@link TraversingEcoMapper#dispose()}.
 * 
 * @param all
 *            graph containing all ontologies, including ECO
 * @param reasoner
 *            reasoner capable of traversing ECO
 * @param disposeReasoner
 *            set to true if the reasoner should be disposed, when calling
 *            {@link TraversingEcoMapper#dispose()}
 * @return mapper
 * @throws IOException
 * @throws OWLException
 * @throws IllegalArgumentException
 *             throw when the reasoner is null, or the
 *             {@link OWLGraphWrapper} does not contain ECO.
 * 
 * @see EcoMapper#ECO_PURL_IRI
 * @see EcoMapper#ECO_MAPPING_PURL
 */
public static TraversingEcoMapper createTraversingEcoMapper(OWLGraphWrapper all, OWLReasoner reasoner, boolean disposeReasoner) throws IOException, OWLException {
	
	// This has bitten me, so let's try and be specific...
	if( reasoner == null )	{
		throw new IllegalArgumentException("No reasoner was specified for use with the EcoTools. Add a reasoner for the command line");
	}
			
	OWLOntology eco = null;
	
	// assume the graph wrapper is more than eco
	// try to find ECO by its purl
	Set<OWLOntology> allOntologies = all.getAllOntologies();
	for (OWLOntology owlOntology : allOntologies) {
		OWLOntologyID id = owlOntology.getOntologyID();
		Optional<IRI> ontologyIRI = id.getOntologyIRI();
		if (ontologyIRI.isPresent()) {
			if (EcoMapper.ECO_PURL_IRI.equals(ontologyIRI.get())) {
				eco = owlOntology;
			}
		}
	}
	if (eco == null) {
		throw new IllegalArgumentException("The specified graph did not contain ECO with the IRI: "+EcoMapper.ECO_PURL_IRI);
	}

	OWLGraphWrapper ecoGraph = new OWLGraphWrapper(eco);
	Reader reader = null;
	try {
		reader = createReader(EcoMapper.ECO_MAPPING_PURL);
		EcoMappings<OWLClass> mappings = loadEcoMappings(reader, ecoGraph);
		return new TraversingEcoMapperImpl(mappings, reasoner, disposeReasoner);
	}
	finally {
		IOUtils.closeQuietly(reader);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:63,代码来源:EcoMapperFactory.java


示例15: getTargetGraph

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
private OWLGraphWrapper getTargetGraph() throws Exception {
	OWLOntologyManager targetManager = OWLManager.createOWLOntologyManager();
	OWLOntologyID ontologyID  = new OWLOntologyID(Optional.of(IRI.create("http://test.owltools.org/dynamic")), Optional.absent());
	OWLOntology targetOntology = targetManager.createOntology(ontologyID);
	OWLGraphWrapper targetGraph = new OWLGraphWrapper(targetOntology);
	return targetGraph;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:8,代码来源:QuerySubsetGeneratorTest.java


示例16: OWLExporter

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Instantiates a {@link OWLExporter} from the specified parameters.
 *
 * @param fileOutputStream the file output stream
 * @throws Exception if something goes wrong in constructor
 */
public OWLExporter(OutputStream fileOutputStream) throws Exception {
  dos = new DataOutputStream(new BufferedOutputStream(fileOutputStream));
  if (snomed == null) {
    // Create a new ontology
    snomed =
        manager
            .createOntology(new OWLOntologyID(snomedIRI, snomedVersionIRI));
    format.setParameter("xml:base", snomedNamespace);

    // Obtain SNOMED root concept
    // TODO: this needs to be generalized
    UUID snomedRootUUID = Taxonomies.SNOMED.getUuids()[0];
    ConceptVersionBI snomedRootConcept =
        OTFUtility.getConceptVersion(snomedRootUUID);

    // Add annotation based on root concept
    for (DescriptionVersionBI<?> desc : snomedRootConcept
        .getDescriptionsActive()) {
      if (desc.getText().contains("Release")) {
        manager.applyChange(new AddOntologyAnnotation(snomed, factory
            .getOWLAnnotation(factory
                .getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_INFO
                    .getIRI()), factory.getOWLLiteral(desc.getText()))));
      }
      if (desc.getText().contains("IHTSDO")) {
        manager.applyChange(new AddOntologyAnnotation(snomed, factory
            .getOWLAnnotation(factory
                .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT
                    .getIRI()), factory.getOWLLiteral(desc.getText()))));
      }
    }
    manager.applyChange(new AddOntologyAnnotation(snomed, factory
        .getOWLAnnotation(factory
            .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
            factory.getOWLLiteral(snomedOntologyName))));
  }
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:44,代码来源:OWLExporter.java


示例17: partition

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Splits the given ontology into two partitions: The set of OWL EL
 * compliant axioms and the set of axioms which are not compliant with the
 * OWL EL profile. The EL compliant partition is stored in the left part of
 * resulting pair, and the EL non-compliant partition is stored in the right
 * part.
 * 
 * @param sourceOnto
 *            The source ontology to be partitioned.
 * @param compatibilityMode
 *            Specifies the reasoner with which the resulting partition
 *            should be compatible (e.g. Pellet has a different notion of EL
 *            than other reasoners).
 * @return A pair containing two ontologies. The left part is the partition
 *         of the source ontology with all EL-compliant axioms. The right
 *         part is the partition of the source ontology with all
 *         non-EL-compliant axioms. If the source ontology already conforms
 *         to the OWL-EL profile, then the left part of the result contains
 *         the source ontology, and the right part is null.
 * @throws OWLOntologyCreationException
 *             If there is an error loading the source ontology.
 * @throws IllegalAccessException 
 * @throws InstantiationException 
 */
public static Pair<OWLOntology, OWLOntology> partition(OWLOntology sourceOnto, ReasonerCompatibilityMode compatibilityMode)
		throws OWLOntologyCreationException, InstantiationException, IllegalAccessException {

	OWLProfile elProfile = compatibilityMode.getProfileClass().newInstance();

	OWLProfileReport report = elProfile.checkOntology(sourceOnto);

	if (report.isInProfile()) {
		return new ImmutablePair<OWLOntology, OWLOntology>(sourceOnto, null);
	}

	HashSet<OWLAxiom> nonELAxioms = new HashSet<OWLAxiom>();

	Set<OWLProfileViolation> violations = report.getViolations();
	for (OWLProfileViolation violation : violations) {
		nonELAxioms.add(violation.getAxiom());
	}

	OWLOntologyID ontologyID = sourceOnto.getOntologyID();
	IRI ontologyIRI = ontologyID.getOntologyIRI();

	IRI targetELOntologyIRI = IRI.create(ontologyIRI.toString() + "/ELpart");
	IRI targetNonELOntologyIRI = IRI.create(ontologyIRI.toString() + "/nonELpart");

	OWLOntologyManager targetELOntoManager = OWLManager.createOWLOntologyManager();
	targetELOntoManager.addIRIMapper(new NonMappingOntologyIRIMapper());
	OWLOntology targetELOnto = targetELOntoManager.createOntology(new OWLOntologyID(targetELOntologyIRI));

	OWLOntologyManager targetNonELOntoManager = OWLManager.createOWLOntologyManager();
	targetNonELOntoManager.addIRIMapper(new NonMappingOntologyIRIMapper());
	OWLOntology targetNonELOnto = targetNonELOntoManager.createOntology(new OWLOntologyID(targetNonELOntologyIRI));

	Set<OWLAxiom> allAxioms = sourceOnto.getAxioms();
	for (OWLAxiom axiom : allAxioms) {
		if (nonELAxioms.contains(axiom)) {
			targetNonELOntoManager.addAxiom(targetNonELOnto, axiom);
			System.out.println("- " + axiom);
		} else {
			targetELOntoManager.addAxiom(targetELOnto, axiom);
			System.out.println("+ " + axiom);
		}
	}

	return new ImmutablePair<OWLOntology, OWLOntology>(targetELOnto, targetNonELOnto);
}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:70,代码来源:PartitionEL.java


示例18: OntologyChangeDataList

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
public OntologyChangeDataList(List<OWLOntologyChange> ontologyChanges, OWLOntologyID targetOntology, long timeStamp, BinaryOWLMetadata metadata) {
    List<OWLOntologyChangeData> infoList = new ArrayList<OWLOntologyChangeData>();
    for(OWLOntologyChange change : ontologyChanges) {
        if(change.getOntology().getOntologyID().equals(targetOntology)) {
            infoList.add(change.getChangeData());
        }
    }
    this.timestamp = timeStamp;
    this.metadata = metadata;
    this.list = Collections.unmodifiableList(infoList);
}
 
开发者ID:matthewhorridge,项目名称:binaryowl,代码行数:12,代码来源:OntologyChangeDataList.java


示例19: importModel

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
/**
 * Try to load (or replace) a model with the given ontology. It is expected
 * that the content is an A-Box ontology, which imports the T-BOX. Also the
 * ontology ID is used to extract the modelId.<br>
 * <br>
 * This method will currently <b>NOT<b> work due to a bug in the OWL-API.
 * The functional syntax parser does not properly report the exceptions and
 * will return an ontology with an wrong ontology ID!
 * 
 * @param modelData
 * @return modelId
 * @throws OWLOntologyCreationException
 */
public ModelContainer importModel(String modelData) throws OWLOntologyCreationException {
	// load data from String
	final OWLOntologyManager manager = graph.getManager();
	final OWLOntologyDocumentSource documentSource = new StringDocumentSource(modelData);
	OWLOntology modelOntology;
	final Set<OWLParserFactory> originalFactories = removeOBOParserFactories(manager);
	try {
		modelOntology = manager.loadOntologyFromOntologyDocument(documentSource);
	}
	catch (OWLOntologyAlreadyExistsException e) {
		// exception is thrown if there is an ontology with the same ID already in memory 
		OWLOntologyID id = e.getOntologyID();
		IRI existingModelId = id.getOntologyIRI().orNull();

		// remove the existing memory model
		unlinkModel(existingModelId);

		// try loading the import version (again)
		modelOntology = manager.loadOntologyFromOntologyDocument(documentSource);
	}
	finally {
		resetOBOParserFactories(manager, originalFactories);
	}
	
	// try to extract modelId
	IRI modelId = null;
	Optional<IRI> ontologyIRI = modelOntology.getOntologyID().getOntologyIRI();
	if (ontologyIRI.isPresent()) {
		modelId = ontologyIRI.get();
	}
	if (modelId == null) {
		throw new OWLOntologyCreationException("Could not extract the modelId from the given model");
	}
	// paranoia check
	ModelContainer existingModel = modelMap.get(modelId);
	if (existingModel != null) {
		unlinkModel(modelId);
	}
	
	// add to internal model
	ModelContainer newModel = addModel(modelId, modelOntology);
	
	// update imports
	updateImports(newModel);
	
	return newModel;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:61,代码来源:CoreMolecularModelManager.java


示例20: catOntologies

import org.semanticweb.owlapi.model.OWLOntologyID; //导入依赖的package包/类
private void catOntologies(Opts opts) throws OWLOntologyCreationException, IOException {
     opts.info("[-r|--ref-ont ONT] [-i|--use-imports]", "Catenate ontologies taking only referenced subsets of supporting onts.\n"+
             "        See Mooncat docs");
     Mooncat m = new Mooncat(g);
     ParserWrapper pw = new ParserWrapper();
     String newURI = null;
     while (opts.hasOpts()) {
         //String opt = opts.nextOpt();
         if (opts.nextEq("-r") || opts.nextEq("--ref-ont")) {
             LOG.error("DEPRECATED - list all ref ontologies on main command line");
             String f = opts.nextOpt();
             m.addReferencedOntology(pw.parseOWL(f));
         }
         else if (opts.nextEq("-s") || opts.nextEq("--src-ont")) {
             m.setOntology(pw.parseOWL(opts.nextOpt()));
         }
         else if (opts.nextEq("-p") || opts.nextEq("--prefix")) {
             m.addSourceOntologyPrefix(opts.nextOpt());
         }
         else if (opts.nextEq("-i") || opts.nextEq("--use-imports")) {
             System.out.println("using everything in imports closure");
             g.addSupportOntologiesFromImportsClosure();
         }
         else if (opts.nextEq("-n") || opts.nextEq("--new-uri")) {
             System.out.println("new URI for merged ontology");
             newURI = opts.nextOpt();
         }
         else {
             break;
             //opts.fail();
         }
     }
     //if (m.getReferencedOntologies().size() == 0) {
     //	m.setReferencedOntologies(g.getSupportOntologySet());
     //}
     //g.useImportClosureForQueries();
     //for (OWLAxiom ax : m.getClosureAxiomsOfExternalReferencedEntities()) {
     //	System.out.println("M_AX:"+ax);
     //}

     m.mergeOntologies();
     m.removeDanglingAxioms();
     if (newURI != null) {
         SetOntologyID soi = new SetOntologyID(g.getSourceOntology(),
                 new OWLOntologyID(Optional.of(IRI.create(newURI)), Optional.<IRI>absent()));
         g.getManager().applyChange(soi);
         /*
HashSet<OWLOntology> cpOnts = new HashSet<OWLOntology>();
LOG.info("srcOnt annots:"+g.getSourceOntology().getAnnotations().size());
cpOnts.add(g.getSourceOntology());
OWLOntology newOnt = g.getManager().createOntology(IRI.create(newURI), cpOnts);
LOG.info("newOnt annots:"+newOnt.getAnnotations().size());

//g.getDataFactory().getOWLOn
g.setSourceOntology(newOnt);
          */
     }
 }
 
开发者ID:owlcollab,项目名称:owltools,代码行数:59,代码来源:CommandRunner.java



注:本文中的org.semanticweb.owlapi.model.OWLOntologyID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParserPoolHolder类代码示例发布时间:2022-05-22
下一篇:
Java ExpiresHeader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap