當前位置: 首頁>>代碼示例>>Java>>正文


Java IRI.equals方法代碼示例

本文整理匯總了Java中org.semanticweb.owlapi.model.IRI.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java IRI.equals方法的具體用法?Java IRI.equals怎麽用?Java IRI.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.semanticweb.owlapi.model.IRI的用法示例。


在下文中一共展示了IRI.equals方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOntologyAnnotationValue

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的package包/類
private String getOntologyAnnotationValue(OWLOntology o, OboFormatTag tag) {
	IRI dateTagIRI = Obo2Owl.trTagToIRI(tag.getTag());
	Set<OWLAnnotation> annotations = o.getAnnotations();
	for (OWLAnnotation annotation : annotations) {
		OWLAnnotationProperty property = annotation.getProperty();
		if(dateTagIRI.equals(property.getIRI())) {
			OWLAnnotationValue value = annotation.getValue();
			if (value != null) {
				if (value instanceof IRI) {
					return ((IRI) value).toString();
				}
				else if (value instanceof OWLLiteral) {
					return ((OWLLiteral) value).getLiteral();
				}
			}
		}
	}
	return null;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:20,代碼來源:OWLGraphWrapperExtended.java

示例2: mergeSpecificImport

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的package包/類
/**
 * Merge a specific ontology from the import closure into the main ontology.
 * Removes the import statement.
 * 
 * @param ontologyIRI id of the ontology to merge
 * @throws OWLOntologyCreationException
 */
public void mergeSpecificImport(IRI ontologyIRI) throws OWLOntologyCreationException {
	OWLOntologyManager manager = getManager();
	Set<OWLOntology> imports = sourceOntology.getImportsClosure();
	for (OWLOntology o : imports) {
		if (o.equals(sourceOntology))
			continue;
		Optional<IRI> currentIRI = o.getOntologyID().getOntologyIRI();
		if (currentIRI.isPresent() && currentIRI.get().equals(ontologyIRI)) {
			String comment = "Includes "+summarizeOntology(o);
			LOG.info(comment);
			addCommentToOntology(sourceOntology, comment);
			manager.addAxioms(sourceOntology, o.getAxioms());	
		}
	}
	Set<OWLImportsDeclaration> oids = sourceOntology.getImportsDeclarations();
	for (OWLImportsDeclaration oid : oids) {
		if (ontologyIRI.equals(oid.getIRI())) {
			RemoveImport ri = new RemoveImport(sourceOntology, oid);
			getManager().applyChange(ri);
		}
	}
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:30,代碼來源:OWLGraphWrapperBasic.java

示例3: testAddEdgeAsBatch

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的package包/類
@Test
public void testAddEdgeAsBatch() throws Exception {
	List<M3Request> batch = new ArrayList<>();
	M3Request r;

	final String individualId = "http://model.geneontology.org/5437882f00000024/5437882f0000032";
	final IRI individualIRI = IRI.create(individualId);
	final String individualIdCurie = curieHandler.getCuri(individualIRI);
	final String modelId = "http://model.geneontology.org/5437882f00000024";
	final ModelContainer model = models.getModel(IRI.create(modelId));
	assertNotNull(model);
	boolean found = false;
	boolean foundCurie = false;
	Set<OWLNamedIndividual> individuals = model.getAboxOntology().getIndividualsInSignature();
	for (OWLNamedIndividual individual : individuals) {
		if (individualIRI.equals(individual.getIRI())) {
			found = true;
			foundCurie = individualIdCurie.equals(curieHandler.getCuri(individual.getIRI()));
		}
	}
	assertTrue(found);
	assertTrue(foundCurie);


	// create new individual
	r = BatchTestTools.addIndividual(modelId, "GO:0003674");
	r.arguments.assignToVariable = "VAR1";
	batch.add(r);

	// add link to existing individual (converted from old model)
	r = BatchTestTools.addEdge(modelId, "VAR1", "BFO:0000050", individualId);
	batch.add(r);

	executeBatch(batch);
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:36,代碼來源:ModelEditTest.java

示例4: exportModel

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的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

示例5: unify

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的package包/類
private BindingSet unify(IRI qin, IRI var,  Set<IRI> vars) {
	BindingSet bset = new BindingSet();
	if (vars.contains(var)) {
		LOG.info(" UNIFYING: ?"+var+" = "+qin);
		bset.varMap.put(var, qin);
		return bset;
	}
	if (qin.equals(var)) {
		// no variable unification but still a match
		return bset;
	}
	return null;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:14,代碼來源:TemplatedTransformer.java

示例6: renderMarkdown

import org.semanticweb.owlapi.model.IRI; //導入方法依賴的package包/類
public static String renderMarkdown(OWLGraphWrapper g, String baseDir, boolean isIncludeImage) {

		OWLOntology ont = g.getSourceOntology();
		StringBuilder out = new StringBuilder();

		String ontId = g.getOntologyId();

		Set<OWLAnnotation> oAnns = ont.getAnnotations();
		System.err.println("NUM1:"+oAnns.size());

		String title = getVal("title", oAnns);

		out.append("## Ontology: "+title+"\n\n");
		out.append("IRI: "+rurl(ont)+"\n\n");

		String desc = getVal("description", oAnns);
		out.append("### Description\n\n");
		out.append(desc+"\n\n");

		Set<OWLOntology> imports = ont.getImports();
		if (imports.size() > 0) {
			out.append("### Imports\n\n");
			for (OWLOntology im : imports) {
				out.append(" * "+rurl(im)+"\n");
			}
		}
		if (isIncludeImage) {
			String imgFn = baseDir + "/" + ontId + ".png";
			out.append("![]("+imgFn+")\n\n");
		}

		System.err.println("NUM:"+oAnns.size());
		if (oAnns.size() > 0) {
			out.append("### Annotations:\n\n");
			for (OWLAnnotation ann : oAnns) {
				String annLabel = g.getLabelOrDisplayId(ann.getProperty());
				OWLAnnotationValue v = ann.getValue();
				String dv = v.toString();
				if (v instanceof OWLLiteral) {
					OWLLiteral lv = ((OWLLiteral)v);
					dv = lv.getLiteral();
					IRI dt = lv.getDatatype().getIRI();
					//System.out.println("DT = "+dt);
					if (dt.equals(OWL2Datatype.XSD_ANY_URI.getIRI())) {
						dv = href(lv.getLiteral());
					}
				}
				out.append(" * "+href(ann.getProperty().getIRI().toString(),annLabel)+" : "+dv+"\n");
			}
		}

		return out.toString();
	}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:54,代碼來源:OntologyMetadataMarkdownWriter.java


注:本文中的org.semanticweb.owlapi.model.IRI.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。