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


Java OWLDataFactory.getOWLObjectComplementOf方法代碼示例

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


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

示例1: testParseClazzNegatedExpression

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Test
public void testParseClazzNegatedExpression() throws Exception {

    JsonOwlObject svf = new JsonOwlObject();     
    svf.type = JsonOwlObjectType.SomeValueFrom;
    svf.property = new JsonOwlObject();
    svf.property.type = JsonOwlObjectType.ObjectProperty;
    svf.property.id = OCCURS_IN; // occurs_in
    svf.filler = new JsonOwlObject();
    svf.filler.id = NUCLEUS;
    svf.filler.type = JsonOwlObjectType.Class;

    JsonOwlObject expression = new JsonOwlObject();
    expression.type = JsonOwlObjectType.ComplementOf;
    expression.filler = svf;
  
    OWLDataFactory df = graph.getDataFactory();
    OWLClassExpression ce = new M3ExpressionParser(curieHandler).parse(graph, expression, null);
    
    OWLClass nucleus = graph.getOWLClassByIdentifier(NUCLEUS);
    OWLObjectSomeValuesFrom svfx = df.getOWLObjectSomeValuesFrom(graph.getOWLObjectPropertyByIdentifier(OCCURS_IN), nucleus);
    OWLObjectComplementOf ceExpected = df.getOWLObjectComplementOf(svfx);
    assertEquals(ceExpected, ce);
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:25,代碼來源:M3ExpressionParserTest.java

示例2: getDisjointConceptNodes

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected Set<HierarchyNode<AtomicConcept>> getDisjointConceptNodes(
		HierarchyNode<AtomicConcept> node) {
	if (m_directDisjointClasses.containsKey(node))
		return m_directDisjointClasses.get(node);
	else {
		Set<HierarchyNode<AtomicConcept>> result = new HashSet<HierarchyNode<AtomicConcept>>();
		OWLDataFactory factory = getDataFactory();
		OWLClassExpression negated = factory
				.getOWLObjectComplementOf(factory.getOWLClass(IRI
						.create(node.getRepresentative().getIRI())));
		HierarchyNode<AtomicConcept> equivalentToComplement = getHierarchyNode(negated);
		for (AtomicConcept equiv : equivalentToComplement
				.getEquivalentElements()) {
			if (!Prefixes.isInternalIRI(equiv.getIRI())) {
				HierarchyNode<AtomicConcept> rootDisjoint = m_atomicConceptHierarchy
						.getNodeForElement(equiv);
				result = Collections.singleton(rootDisjoint);
				m_directDisjointClasses.put(node, result);
				return result;
			}
		}
		result = equivalentToComplement.getChildNodes();
		m_directDisjointClasses.put(node, result);
		return result;
	}
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:27,代碼來源:Reasoner.java

示例3: testUnsatifiabilityDueToClashInABoxAssertions

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
   * Atomic clash
   */
  public void testUnsatifiabilityDueToClashInABoxAssertions() {
  	OWLDataFactory factory = OWLManager.getOWLDataFactory();
  	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
  	
  	OWLClassExpression expr1 = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
  	OWLClassExpression expr2 = factory.getOWLObjectComplementOf(expr1);
  	OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
  	
  	OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(expr1, indiv);
  	OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(expr2, indiv);
  	
  	try {
	OWLOntology ontology = manager.createOntology();
	manager.addAxiom(ontology, fact1);
	manager.addAxiom(ontology, fact2);
	
	Wolpertinger wolpertinger = new Wolpertinger(ontology);
	
	assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
	e.printStackTrace();
	fail();
}
  }
 
開發者ID:wolpertinger-reasoner,項目名稱:Wolpertinger,代碼行數:28,代碼來源:WolpertingerTest.java

示例4: rewriteNegativeObjectPropertyAssertions

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public int rewriteNegativeObjectPropertyAssertions(OWLDataFactory factory,OWLAxioms axioms,int replacementIndex) {
    // now object property inclusion manager added all non-simple properties to axioms.m_complexObjectPropertyExpressions
    // now that we know which roles are non-simple, we can decide which negative object property assertions have to be
    // expressed as concept assertions so that transitivity rewriting applies properly. All new concepts for the concept
    // assertions must be normalised, because we are done with the normal normalisation phase.
    Set<OWLIndividualAxiom> redundantFacts=new HashSet<OWLIndividualAxiom>();
    Set<OWLIndividualAxiom> additionalFacts=new HashSet<OWLIndividualAxiom>();
    for (OWLIndividualAxiom axiom : axioms.m_facts) {
        if (axiom instanceof OWLNegativeObjectPropertyAssertionAxiom) {
            OWLNegativeObjectPropertyAssertionAxiom negAssertion=(OWLNegativeObjectPropertyAssertionAxiom)axiom;
            OWLObjectPropertyExpression prop=negAssertion.getProperty().getSimplified();
            if (axioms.m_complexObjectPropertyExpressions.contains(prop)) {
                // turn not op(a b) into
                // C(a) and not C or forall op not{b}
                OWLIndividual individual=negAssertion.getObject();
                // neg. op assertions cannot contain anonymous individuals
                OWLClass individualConcept=factory.getOWLClass(IRI.create("internal:nom#"+individual.asOWLNamedIndividual().getIRI().toString()));
                OWLClassExpression notIndividualConcept=factory.getOWLObjectComplementOf(individualConcept);
                OWLClassExpression allNotIndividualConcept=factory.getOWLObjectAllValuesFrom(prop,notIndividualConcept);
                OWLClassExpression definition=factory.getOWLClass(IRI.create("internal:def#"+(replacementIndex++)));
                axioms.m_conceptInclusions.add(new OWLClassExpression[] { factory.getOWLObjectComplementOf(definition), allNotIndividualConcept });
                additionalFacts.add(factory.getOWLClassAssertionAxiom(definition,negAssertion.getSubject()));
                additionalFacts.add(factory.getOWLClassAssertionAxiom(individualConcept,individual));
                redundantFacts.add(negAssertion);
            }
        }
    }
    axioms.m_facts.addAll(additionalFacts);
    axioms.m_facts.removeAll(redundantFacts);
    return replacementIndex;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:32,代碼來源:ObjectPropertyInclusionManager.java

示例5: testUnsatisfiabilityDuetoSimpleSubsumptionViolation

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public void testUnsatisfiabilityDuetoSimpleSubsumptionViolation() {
  	OWLDataFactory factory = OWLManager.getOWLDataFactory();
  	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
  	
  	OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
  	OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B")));
  	OWLClassExpression complClassB = factory.getOWLObjectComplementOf(classB);
  	
  	OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
  	
  	OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indiv);
  	OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(complClassB, indiv);
  	
  	OWLSubClassOfAxiom subClOf = factory.getOWLSubClassOfAxiom(classA, classB);
  	
  	try {
	OWLOntology ontology = manager.createOntology();
	manager.addAxiom(ontology, fact1);
	manager.addAxiom(ontology, fact2);
	manager.addAxiom(ontology, subClOf);
	
	Wolpertinger wolpertinger = new Wolpertinger(ontology);
	
	assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
	e.printStackTrace();
	fail();
}
  }
 
開發者ID:wolpertinger-reasoner,項目名稱:Wolpertinger,代碼行數:30,代碼來源:WolpertingerTest.java


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