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

Java OWLClassAxiom类代码示例

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

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



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

示例1: hasFilterClass

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
/**
 * Check that there is an axiom, which use a class (in its signature) that
 * has a ancestor in the root term set.
 * 
 * @param axioms set to check
 * @param rootTerms set root of terms
 * @return boolean
 */
private boolean hasFilterClass(Set<OWLClassAxiom> axioms, Set<OWLClass> rootTerms) {
    if (axioms != null && !axioms.isEmpty()) {
        for (OWLClassAxiom ax : axioms) {
            if (ax instanceof OWLEquivalentClassesAxiom) {
                Set<OWLClass> signature = ax.getClassesInSignature();
                for (OWLClass sigCls : signature) {
                    NodeSet<OWLClass> superClasses = reasoner.getSuperClasses(sigCls, false);
                    for(OWLClass root : rootTerms) {
                        if (superClasses.containsEntity(root)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:CommandRunner.java


示例2: testSpecies

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
private void testSpecies(OWLOntology ontology) {
	IRI iri = IRI.create("http://purl.obolibrary.org/obo/NCBITaxon_species");
	OWLDataFactory df = ontology.getOWLOntologyManager().
		getOWLDataFactory();
	OWLClass taxon = df.getOWLClass(iri);
	assertTrue("Species class in signature",
		ontology.containsClassInSignature(iri));
	
	// Check axioms
	Set<OWLClassAxiom> axioms = ontology.getAxioms(taxon, Imports.EXCLUDED);
	assertEquals("Count class axioms", 1, axioms.size());
	assertEquals("SubClassOf(<http://purl.obolibrary.org/obo/NCBITaxon_species> <http://purl.obolibrary.org/obo/NCBITaxon#_taxonomic_rank>)", axioms.toArray()[0].toString());

	// Check annotations
	List<String> values = new ArrayList<String>();
	values.add("AnnotationAssertion(<http://www.geneontology.org/formats/oboInOwl#hasOBONamespace> <http://purl.obolibrary.org/obo/NCBITaxon_species> \"ncbi_taxonomy\"^^xsd:string)");
	values.add("AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/NCBITaxon_species> \"species\"^^xsd:string)");

	Set<OWLAnnotationAssertionAxiom> annotations = 
		ontology.getAnnotationAssertionAxioms(iri);
	assertEquals("Count annotations for Species", 2, annotations.size());

	checkAnnotations(annotations, values);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:NCBI2OWLTest.java


示例3: processAnatomy

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
public void processAnatomy(Owlbuilder builder, OWLClass anatomyClass) {
	final OWLOntologyManager manager = builder.getOntologyManager();
	final OWLOntology merged = builder.getMergedSources();
	final OWLOntology extracted = builder.getTarget();
	if (true){
		log.info("Need to add anatomy: " + anatomyClass.getIRI());
		Set<OWLClassAxiom> anatAxioms = merged.getAxioms(anatomyClass,org.semanticweb.owlapi.model.parameters.Imports.INCLUDED);
		manager.addAxioms(extracted, anatAxioms);
		Set<OWLAnnotationAssertionAxiom> anatAnnotations =
				merged.getAnnotationAssertionAxioms(anatomyClass.getIRI());
		for (OWLAnnotationAssertionAxiom a : anatAnnotations){
			//log.info("   Annotation Axiom: " + a.toString());
			if (a.getAnnotation().getProperty().isLabel()){
				log.info("Label is " + a.getAnnotation().getValue().toString());
				manager.addAxiom(extracted, a);
			}
		}
	}
   	builder.initializeMiscTermAndParents(anatomyClass);

}
 
开发者ID:pmidford,项目名称:owlbuilder,代码行数:22,代码来源:Participant.java


示例4: check

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
protected void check(OWLClass owlClass, OWLGraphWrapper graph, List<CheckWarning> warnings, OWLPrettyPrinter pp) {
	final Set<OWLOntology> allOntologies = graph.getAllOntologies();
	for(OWLOntology ontology : allOntologies){
		Set<OWLClassAxiom> axioms = ontology.getAxioms(owlClass, Imports.EXCLUDED);
		if (axioms != null && !axioms.isEmpty()) {
			// check axioms 
			for (OWLClassAxiom axiom : axioms) {
				Set<OWLClass> signature = axiom.getClassesInSignature();
				for (OWLClass signatureClass : signature) {
					if (graph.isObsolete(signatureClass)) {
						StringBuilder sb = new StringBuilder();
						sb.append("Obsolete class ");
						String id = graph.getIdentifier(signatureClass);
						if (id != null) {
							sb.append(id);
							String sigLabel = graph.getLabel(signatureClass);
							if (sigLabel != null) {
								sb.append(" '").append(sigLabel).append('\'');
							}
						}
						else {
							sb.append(signatureClass.getIRI());
						}
						sb.append(" in axiom: ");
						sb.append(pp.render(axiom));
						warnings.add(new CheckWarning(getID(), sb.toString() , isFatal(), owlClass.getIRI()));
					}
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:33,代码来源:ObsoleteClassInSignature.java


示例5: check

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
protected void check(OWLClass owlClass, OWLGraphWrapper graph, Map<String, OWLObject> altIds, List<CheckWarning> warnings, OWLPrettyPrinter pp) {
	final Set<OWLOntology> allOntologies = graph.getAllOntologies();
	for(OWLOntology ontology : allOntologies){
		Set<OWLClassAxiom> axioms = ontology.getAxioms(owlClass, Imports.EXCLUDED);
		if (axioms != null && !axioms.isEmpty()) {
			// check axioms 
			for (OWLClassAxiom axiom : axioms) {
				Set<OWLClass> signature = axiom.getClassesInSignature();
				for (OWLClass signatureClass : signature) {
					String identifier = graph.getIdentifier(signatureClass);
					if (identifier != null) {
						OWLObject replacement = altIds.get(identifier);
						if (replacement != null) {
							StringBuilder sb = new StringBuilder();
							sb.append("Alternate Identifier ");
							sb.append(identifier);
							sb.append(" for main class ");
							String replacementId = graph.getIdentifier(replacement);
							if (replacementId != null) {
								sb.append(replacementId);
								String replacementLabel = graph.getLabel(replacement);
								if (replacementLabel != null) {
									sb.append(" '").append(replacementLabel).append('\'');
								}
							}
							else {
								sb.append(replacement);
							}
							sb.append(" in axiom: ");
							sb.append(pp.render(axiom));
							warnings.add(new CheckWarning(getID(), sb.toString() , isFatal(), owlClass.getIRI()));
						}
					}
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:39,代码来源:AltIdInSignature.java


示例6: testBacteria

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
private void testBacteria(OWLOntology ontology) {
	String curie = "ncbi:2";
	IRI iri = OWLConverter.format.getIRI(curie);
	OWLDataFactory df = ontology.getOWLOntologyManager().
		getOWLDataFactory();
	OWLClass taxon = df.getOWLClass(iri);
	assertTrue("Bacteria class in signature",
		ontology.containsClassInSignature(iri));

	// Check axioms
	Set<OWLClassAxiom> axioms = ontology.getAxioms(taxon, Imports.EXCLUDED);
	assertEquals("Count class axioms for Bacteria", 1, axioms.size());
	assertEquals("SubClassOf(<http://purl.obolibrary.org/obo/NCBITaxon_2> <http://purl.obolibrary.org/obo/NCBITaxon_131567>)", axioms.toArray()[0].toString());

	// Check annotations
	List<String> values = new ArrayList<String>();
	values.add(expandAnnotation(curie, "ncbitaxon:has_rank", OWLConverter.format.getIRI("ncbi:superkingdom")));
	values.add(expandAnnotation(curie, "oio:hasOBONamespace", "ncbi_taxonomy"));
	values.add(expandAnnotation(curie, "oio:hasDbXref", "GC_ID:11"));
	values.add(expandLabel(curie, "rdfs:label", "Bacteria"));
	values.add(expandSynonym(curie, "ncbitaxon:genbank_common_name", "oio:hasExactSynonym", "eubacteria"));
	values.add(expandSynonym(curie, "ncbitaxon:synonym", "oio:hasRelatedSynonym", "not Bacteria Haeckel 1894"));
	values.add(expandSynonym(curie, "ncbitaxon:in_part", "oio:hasRelatedSynonym", "Prokaryota"));
	values.add(expandSynonym(curie, "ncbitaxon:in_part", "oio:hasRelatedSynonym", "Monera"));
	values.add(expandSynonym(curie, "ncbitaxon:in_part", "oio:hasRelatedSynonym", "Procaryotae"));
	values.add(expandSynonym(curie, "ncbitaxon:in_part", "oio:hasRelatedSynonym", "Prokaryotae"));
	values.add(expandSynonym(curie, "ncbitaxon:blast_name", "oio:hasRelatedSynonym", "eubacteria"));

	Set<OWLAnnotationAssertionAxiom> annotations = 
		ontology.getAnnotationAssertionAxioms(iri);
	assertEquals("Count annotations for Bacteria", values.size(), annotations.size());

	checkAnnotations(annotations, values);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:35,代码来源:NCBI2OWLTest.java


示例7: testActinobacteria

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
private void testActinobacteria(OWLOntology ontology) {
	String curie = "ncbi:201174";
	IRI iri = OWLConverter.format.getIRI(curie);
	OWLDataFactory df = ontology.getOWLOntologyManager().
		getOWLDataFactory();
	OWLClass taxon = df.getOWLClass(iri);
	assertTrue("Actinobacteria class in signature",
		ontology.containsClassInSignature(iri));

	// Check axioms
	Set<OWLClassAxiom> axioms = ontology.getAxioms(taxon, Imports.EXCLUDED);
	assertEquals("Count class axioms for Actinobacteria", 1, axioms.size());
	assertEquals("SubClassOf(<http://purl.obolibrary.org/obo/NCBITaxon_201174> <http://purl.obolibrary.org/obo/NCBITaxon_2>)", axioms.toArray()[0].toString());

	// Check annotations
	List<String> values = new ArrayList<String>();
	values.add(expandAnnotation(curie, "ncbitaxon:has_rank", OWLConverter.format.getIRI("ncbi:phylum")));
	values.add(expandAnnotation(curie, "oio:hasOBONamespace", "ncbi_taxonomy"));
	values.add(expandAnnotation(curie, "oio:hasDbXref", "GC_ID:11"));
	values.add(expandLabel(curie, "rdfs:label", "Actinobacteria [NCBITaxon:201174]"));
	values.add(expandSynonym(curie, "ncbitaxon:scientific_name", "oio:hasExactSynonym", "Actinobacteria"));
	values.add(expandSynonym(curie, "ncbitaxon:synonym", "oio:hasRelatedSynonym", "'Actinobacteria'"));
	values.add(expandSynonym(curie, "ncbitaxon:synonym", "oio:hasRelatedSynonym", "not Actinobacteria Cavalier-Smith 2002"));
	values.add(expandSynonym(curie, "ncbitaxon:blast_name", "oio:hasRelatedSynonym", "actinobacteria"));

	Set<OWLAnnotationAssertionAxiom> annotations = 
		ontology.getAnnotationAssertionAxioms(iri);
	assertEquals("Count annotations for Actinobacteria",
			values.size(), annotations.size());

	checkAnnotations(annotations, values);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:33,代码来源:NCBI2OWLTest.java


示例8: fullEquivalenceClassesAreAdded

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
@Test
public void fullEquivalenceClassesAreAdded() throws Exception {
  OWLClass e0 = dataFactory.getOWLClass(IRI.create("http://example.org/e0"));
  OWLClass e1 = dataFactory.getOWLClass(IRI.create("http://example.org/e1"));
  OWLClass e2 = dataFactory.getOWLClass(IRI.create("http://example.org/e2"));
  OWLClassAxiom fullEquivalence = dataFactory.getOWLEquivalentClassesAxiom(e0, e1, e2);
  assertThat(ont.containsAxiom(fullEquivalence), is(false));
  util.removeUnsatisfiableClasses();
  util.reason();
  assertThat(ont.containsAxiom(fullEquivalence), is(true));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:12,代码来源:ReasonerUtilTest.java


示例9: subclassHierarchyIsRepaired

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
@Test
public void subclassHierarchyIsRepaired() throws Exception {
  OWLClass dx = dataFactory.getOWLClass(IRI.create("http://example.org/dx"));
  OWLClass cx = dataFactory.getOWLClass(IRI.create("http://example.org/cx"));
  OWLClass root = dataFactory.getOWLClass(IRI.create("http://example.org/root"));
  OWLClassAxiom inferrredSubclass = dataFactory.getOWLSubClassOfAxiom(dx, cx);
  OWLClassAxiom originalSubclass = dataFactory.getOWLSubClassOfAxiom(dx, root);
  assertThat(ont.containsAxiom(inferrredSubclass), is(false));
  assertThat(ont.containsAxiom(originalSubclass), is(true));
  util.removeUnsatisfiableClasses();
  util.reason();
  assertThat(ont.containsAxiom(inferrredSubclass), is(true));
  assertThat(ont.containsAxiom(originalSubclass), is(false));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:15,代码来源:ReasonerUtilTest.java


示例10: redundantAxioms_areRemoved

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
@Test
public void redundantAxioms_areRemoved() throws Exception {
  OWLClass e = dataFactory.getOWLClass(IRI.create("http://example.org/e"));
  OWLClass c = dataFactory.getOWLClass(IRI.create("http://example.org/c"));
  OWLClassAxiom originalSubclass = dataFactory.getOWLSubClassOfAxiom(e, c);
  assertThat(ont.containsAxiom(originalSubclass), is(true));
  util.removeRedundantAxioms();
  assertThat(ont.containsAxiom(originalSubclass), is(false)); 
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:10,代码来源:ReasonerUtilTest.java


示例11: convert

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
@SuppressWarnings("static-method")
public ElkClassAxiom convert(OWLClassAxiom owlClassAxiom) {
	return owlClassAxiom.accept(OWL_CLASS_AXIOM_CONVERTER);
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:5,代码来源:OwlConverter.java


示例12: assertAllInferences

import org.semanticweb.owlapi.model.OWLClassAxiom; //导入依赖的package包/类
public static void assertAllInferences(OWLGraphWrapper graph, String idsInputFile) {
		final OWLOntology ontology = graph.getSourceOntology();
		final OWLOntologyManager manager = ontology.getOWLOntologyManager();
		final OWLDataFactory factory = manager.getOWLDataFactory();
		
		Set<String> ids = loadIdsInputFile(idsInputFile);
		
		final OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
		final OWLReasoner reasoner = reasonerFactory.createReasoner(ontology);
		try {
			logger.info("Start check all");
			// check all classes from the main ontology
			AllInferenceReport report = new AllInferenceReport();
			Set<OWLClass> classes = ontology.getClassesInSignature(Imports.EXCLUDED);
			int count = 0;
			int total = ids != null ? ids.size() : classes.size();
			int step = 100;
			for (final OWLClass owlClass : classes) {
				if (ids != null) {
					String id = graph.getIdentifier(owlClass);
					if (ids.contains(id) == false) {
						continue;
					}
				}
				count += 1;
				// get axioms for the current class
				Set<OWLClassAxiom> axioms = ontology.getAxioms(owlClass, Imports.EXCLUDED);
				
				handleAxioms(owlClass, axioms, ontology, manager, factory, reasoner, report);
//				handleAxioms2(owlClass, axioms, ontology, manager, factory, reasoner, report);
				if (count % step == 0) {
					logger.info("Current count "+count+" of "+total);
				}
			}
			PrintWriter writer = new PrintWriter(System.out);
			report.printReport(writer);
			writer.close();
		}
		finally {
			reasoner.dispose();
		}
	}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:43,代码来源:AssertInferenceTool.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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