当前位置: 首页>>代码示例>>Java>>正文


Java OWLOntologyID类代码示例

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


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


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