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


Java OWLDataFactory.getOWLObjectProperty方法代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLObjectProperty方法的典型用法代码示例。如果您正苦于以下问题:Java OWLDataFactory.getOWLObjectProperty方法的具体用法?Java OWLDataFactory.getOWLObjectProperty怎么用?Java OWLDataFactory.getOWLObjectProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.semanticweb.owlapi.model.OWLDataFactory的用法示例。


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

示例1: objectPropertyHierarchyNodeToNode

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
protected Node<OWLObjectPropertyExpression> objectPropertyHierarchyNodeToNode(
		HierarchyNode<Role> hierarchyNode) {
	Set<OWLObjectPropertyExpression> result = new HashSet<OWLObjectPropertyExpression>();
	OWLDataFactory factory = getDataFactory();
	for (Role role : hierarchyNode.getEquivalentElements()) {
		if (role instanceof AtomicRole)
			result.add(factory.getOWLObjectProperty(IRI
					.create(((AtomicRole) role).getIRI())));
		else {
			OWLObjectPropertyExpression ope = factory
					.getOWLObjectProperty(IRI.create(((InverseRole) role)
							.getInverseOf().getIRI()));
			result.add(factory.getOWLObjectInverseOf(ope));
		}
	}
	return new OWLObjectPropertyNode(result);
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:18,代码来源:Reasoner.java

示例2: prepare

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
@Override
void prepare() {
	final OWLDataFactory factory = new OWLDataFactoryImpl();
	A = factory.getOWLClass(IRI.create("A"));
	B = factory.getOWLClass(IRI.create("B"));
	OWLObjectProperty R = factory.getOWLObjectProperty(IRI.create("R"));
	OWLObjectProperty S = factory.getOWLObjectProperty(IRI.create("S"));
	OWLAxiom axExSsomeAsubB = factory.getOWLSubClassOfAxiom(
			factory.getOWLObjectSomeValuesFrom(S, A), B);
	OWLAxiom axReflR = factory.getOWLReflexiveObjectPropertyAxiom(R);
	axRsubS = factory.getOWLSubObjectPropertyOfAxiom(R, S);
	// from these three axioms it should follow A subclass B
	ontologyManager = TestOWLManager.createOWLOntologyManager();
	try {
		ont = ontologyManager.createOntology(new HashSet<OWLAxiom>(Arrays
				.asList(axExSsomeAsubB, axReflR, axRsubS)));
	} catch (OWLOntologyCreationException e) {
		fail(e.toString());
	}
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:21,代码来源:RoleAxiomOWLAPILowLevelIncrementalClassTest.java

示例3: getAxiomsForReadingOffCompexProperties

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
public OWLAxiom[] getAxiomsForReadingOffCompexProperties(OWLDataFactory factory, ReasonerProgressMonitor monitor, int completedSteps, int steps) {
    if (m_complexRoles.size()>0) {
        int noAdditionalAxioms=0;
        List<OWLAxiom> additionalAxioms=new ArrayList<OWLAxiom>();
        m_interruptFlag.startTask();
        try {
            for (;m_currentIndividualIndex<m_individuals.length && noAdditionalAxioms < thresholdForAdditionalAxioms;m_currentIndividualIndex++) {
                Individual ind=m_individuals[m_currentIndividualIndex];
                for (AtomicRole objectRole : m_complexRoles) {
                    completedSteps++;
                    if (monitor!=null)
                        monitor.reasonerTaskProgressChanged(completedSteps,steps);
                    OWLObjectProperty objectProperty=factory.getOWLObjectProperty(IRI.create(objectRole.getIRI()));
                    String indIRI=ind.getIRI();
                    OWLClass classForIndividual=factory.getOWLClass(IRI.create("internal:individual-concept#"+indIRI));
                    OWLAxiom axiom=factory.getOWLClassAssertionAxiom(classForIndividual,factory.getOWLNamedIndividual(IRI.create(indIRI)));
                    additionalAxioms.add(axiom); // A_a(a)
                    AtomicConcept conceptForRole=AtomicConcept.create("internal:individual-concept#"+objectRole.getIRI()+"#"+indIRI);
                    OWLClass classForRoleAndIndividual=factory.getOWLClass(IRI.create(conceptForRole.getIRI()));
                    axiom=factory.getOWLSubClassOfAxiom(classForIndividual,factory.getOWLObjectAllValuesFrom(objectProperty,classForRoleAndIndividual));
                    additionalAxioms.add(axiom); // A_a implies forall r.A_a^r
                    noAdditionalAxioms+=2;
                    m_interruptFlag.checkInterrupt();
                }
            }
        } finally {
            m_interruptFlag.endTask();
        }
        OWLAxiom[] additionalAxiomsArray=new OWLAxiom[additionalAxioms.size()];
        return additionalAxioms.toArray(additionalAxiomsArray);
    }
    else {
        m_currentIndividualIndex=m_individuals.length-1;
        return new OWLAxiom[0];
    }
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:37,代码来源:InstanceManager.java

示例4: isRoleInstance

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
protected boolean isRoleInstance(Role role, Individual individual1, Individual individual2) {
    OWLDataFactory factory=m_reasoner.getDataFactory();
    AtomicRole atomicRole;
    if (role instanceof InverseRole) {
        Individual tmp=individual1;
        individual1=individual2;
        individual2=tmp;
        atomicRole=((InverseRole)role).getInverseOf();
    }
    else
        atomicRole=(AtomicRole)role;
    OWLObjectProperty property=factory.getOWLObjectProperty(IRI.create(atomicRole.getIRI()));
    OWLNamedIndividual namedIndividual1=factory.getOWLNamedIndividual(IRI.create(individual1.getIRI()));
    OWLNamedIndividual namedIndividual2=factory.getOWLNamedIndividual(IRI.create(individual2.getIRI()));
    OWLClass pseudoNominal=factory.getOWLClass(IRI.create("internal:pseudo-nominal"));
    OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(property,pseudoNominal.getObjectComplementOf());
    OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,namedIndividual1);
    OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,namedIndividual2);
    Tableau tableau=m_reasoner.getTableau(allNotPseudoNominalAssertion,pseudoNominalAssertion);
    boolean result=!tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",individual1,individual2,atomicRole));
    if (m_tableauMonitor!=null) {
        if (result)
            m_tableauMonitor.possibleInstanceIsInstance();
        else 
            m_tableauMonitor.possibleInstanceIsNotInstance();
    }
    return result;
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:29,代码来源:InstanceManager.java

示例5: testUnsatisfiabilityDoToFixedDomain1

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
/**
   * Smth like
   *    A subClassOf r min 5 B
   *  But we have only a domain with 4 elements ...
   */
  public void testUnsatisfiabilityDoToFixedDomain1() {
  	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")));
  	OWLObjectPropertyExpression roleR = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "r")));
  	
  	OWLNamedIndividual indA = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
  	OWLNamedIndividual indB = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "b")));
  	OWLNamedIndividual indC = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "c")));
  	OWLNamedIndividual indD = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "d")));

  	OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indA);
  	OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(classA, indB);
  	OWLIndividualAxiom fact3 = factory.getOWLClassAssertionAxiom(classA, indC);
  	OWLIndividualAxiom fact4 = factory.getOWLClassAssertionAxiom(classA, indD);
  	
  	OWLObjectMinCardinality exprRmin5B = factory.getOWLObjectMinCardinality(5, roleR, classB);
  	OWLSubClassOfAxiom axmAsubRsomeB = factory.getOWLSubClassOfAxiom(classA, exprRmin5B);
  	
  	try {
	OWLOntology ontology = manager.createOntology();
	manager.addAxiom(ontology, fact1);
	manager.addAxiom(ontology, fact2);
	manager.addAxiom(ontology, fact3);
	manager.addAxiom(ontology, fact4);
	manager.addAxiom(ontology, axmAsubRsomeB);
	
	Wolpertinger wolpertinger = new Wolpertinger(ontology);
	
	assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
	e.printStackTrace();
	fail();
}
  }
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:43,代码来源:WolpertingerTest.java

示例6: FindTaxonTool

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
public FindTaxonTool(CurieHandler curieHandler, OWLDataFactory df) {
	this.curieHandler = curieHandler;
	inTaxon = df.getOWLObjectProperty(IN_TAXON_IRI);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:5,代码来源:FindTaxonTool.java

示例7: main

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException {
	OWLOntologyManager man = OWLManager.createOWLOntologyManager();
	OWLDataFactory dataFactory = man.getOWLDataFactory();

	// Load your ontology.
	OWLOntology ont = man.loadOntologyFromOntologyDocument(new File(
			"c:/ontologies/ontology.owl"));

	// Create an ELK reasoner.
	OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
	OWLReasoner reasoner = reasonerFactory.createReasoner(ont);

	// Create your desired query class expression. In this example we
	// will query ObjectIntersectionOf(A ObjectSomeValuesFrom(R B)).
	PrefixManager pm = new DefaultPrefixManager("http://example.org/");
	OWLClass A = dataFactory.getOWLClass(":A", pm);
	OWLObjectProperty R = dataFactory.getOWLObjectProperty(":R", pm);
	OWLClass B = dataFactory.getOWLClass(":B", pm);
	OWLClassExpression query = dataFactory.getOWLObjectIntersectionOf(A,
			dataFactory.getOWLObjectSomeValuesFrom(R, B));

	// Create a fresh name for the query.
	OWLClass newName = dataFactory.getOWLClass(IRI.create("temp001"));
	// Make the query equivalent to the fresh class
	OWLAxiom definition = dataFactory.getOWLEquivalentClassesAxiom(newName,
			query);
	man.addAxiom(ont, definition);

	// Remember to either flush the reasoner after the ontology change
	// or create the reasoner in non-buffering mode. Note that querying
	// a reasoner after an ontology change triggers re-classification of
	// the whole ontology which might be costly. Therefore, if you plan
	// to query for multiple complex class expressions, it will be more
	// efficient to add the corresponding definitions to the ontology at
	// once before asking any queries to the reasoner.
	reasoner.flush();

	// You can now retrieve subclasses, superclasses, and instances of
	// the query class by using its new name instead.
	reasoner.getSubClasses(newName, true);
	reasoner.getSuperClasses(newName, true);
	reasoner.getInstances(newName, false);

	// After you are done with the query, you should remove the definition
	man.removeAxiom(ont, definition);

	// You can now add new definitions for new queries in the same way

	// After you are done with all queries, do not forget to free the
	// resources occupied by the reasoner
	reasoner.dispose();
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:53,代码来源:QueryingUnnamedClassExpressions.java

示例8: testNestedInverses

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
/**
 * Testing correctness of converting nested inverses
 */
@Test
public void testNestedInverses() {
	
	
	OWLDataFactory factory = new OWLDataFactoryImpl();
	OWLObjectProperty r = factory.getOWLObjectProperty(IRI.create("R"));
	OWLObjectPropertyExpression ri = factory.getOWLObjectInverseOf(r);
	
	OWLPropertyExpressionVisitorEx<ElkObjectPropertyExpression> converter = OwlObjectPropertyExpressionConverterVisitor
			.getInstance();

	ElkObjectPropertyExpression s = r.accept(converter);
	ElkObjectPropertyExpression si = ri.accept(converter);

	assertTrue(s instanceof ElkObjectProperty);
	assertTrue(si instanceof ElkObjectInverseOf);

	ElkIri expectedIri = ((ElkObjectProperty) s).getIri();

	assertEquals(expectedIri, ((ElkObjectInverseOf) si).getObjectProperty()
			.getIri());
		
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:27,代码来源:OwlObjectPropertyExpressionConverterVisitorTest.java

示例9: makeUnionUsingReflexiveProperty

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
/**
 * makes a reduced union expression.
 * 
 * Uses the following two reduction rules:
 * 
 * (r1 some X) U (r2 some Y) ==> lcs(r1,r2) some MakeUnionOf(X,Y)
 * (r1 some X) U X ==> reflexive-version-of-r1 some X
 * 
 * TODO: test for (r some r some X) u (r some X) cases. needs to be done over final expression.
 *  
 * if a reduced form cannot be made, returns null
 * 
 * @param xa
 * @param xb
 * @return class expression
 */
private OWLClassExpression makeUnionUsingReflexiveProperty(OWLClassExpression xa, OWLClassExpression xb) {
	LOG.info("testing if there is a more compact union expression for "+xa+" ++ "+xb);
	OWLDataFactory df = graph.getDataFactory();
	if (xa instanceof OWLQuantifiedRestriction) {
		// TODO - check before casting
		OWLObjectProperty prop = (OWLObjectProperty) ((OWLQuantifiedRestriction) xa).getProperty();
		OWLClassExpression xaRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xa).getFiller();
		if (xb instanceof OWLQuantifiedRestriction) {
			OWLObjectPropertyExpression p2 =
				propertySubsumer(prop, 
					((OWLQuantifiedObjectRestriction) xb).getProperty());
			
			if (p2 != null) {
				OWLClassExpression xbRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xb).getFiller();
				OWLClassExpression x = makeUnionWithReduction(xaRest,xbRest);
				// todo - mixing some and all
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(p2,x);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(p2, x);
			}
		}
		LOG.info("  test: "+xaRest+" == "+xb);
		

		if (xaRest.equals(xb)) {
			LOG.info("     TRUE: "+xaRest+" == "+xb);

			OWLObjectProperty rprop = null;
			if (graph.getIsReflexive(prop)) {
				rprop = prop;
			}
			if (forceReflexivePropertyCreation) {
				OWLOntologyManager manager = graph.getManager();
				OWLOntology ont = graph.getSourceOntology();
				rprop = 
					df.getOWLObjectProperty(IRI.create(prop.getIRI().toString()+"_reflexive"));
				manager.applyChange(new AddAxiom(ont, df.getOWLSubObjectPropertyOfAxiom(prop, rprop)));
				manager.applyChange(new AddAxiom(ont, df.getOWLTransitiveObjectPropertyAxiom(rprop)));
				LOG.info("  reflexive prop:"+rprop);

			}
			if (rprop != null) {
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(rprop,xb);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(rprop, xb);
			}

		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:70,代码来源:DescriptionTreeSimilarity.java

示例10: testPhenoViewWithIndividuals

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
/**
 * In this test we filter view classes based on the individuals in the ontology
 * 
 * @throws IOException
 * @throws OWLOntologyCreationException
 * @throws OWLOntologyStorageException
 */
@Test
public void testPhenoViewWithIndividuals() throws IOException, OWLOntologyCreationException, OWLOntologyStorageException {
	ParserWrapper pw = new ParserWrapper();
	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
	OWLDataFactory df = manager.getOWLDataFactory();
	OWLOntology sourceOntol = pw.parseOWL(getResourceIRIString("q-in-e.omn"));

	OWLObjectProperty viewProperty = 
		df.getOWLObjectProperty(IRI.create("http://x.org#has_phenotype_inheres_in"));

	PropertyViewOntologyBuilder pvob = 
		new PropertyViewOntologyBuilder(sourceOntol,
				sourceOntol,
				viewProperty);

	pvob.setClassifyIndividuals(true);
	pvob.setFilterUnused(true);
	pvob.setViewLabelPrefix("involves ");
	pvob.setViewLabelSuffix("");
	pvob.setAssumeOBOStyleIRIs(false);
	//pvob.setUseOriginalClassIRIs(true);

	pvob.buildViewOntology(IRI.create("http://x.org"), IRI.create("http://y.org"));
	OWLOntology avo = pvob.getAssertedViewOntology();
	if (RENDER_ONTOLOGY_FLAG) {
		for (OWLAxiom a : avo.getAxioms()) {
			LOG.info("ASSERTED_VIEW_ONT: " + a);
		}
	}
	OWLReasonerFactory rf = new ElkReasonerFactory();
	OWLReasoner reasoner = rf.createReasoner(avo);
	try {
		OWLGraphWrapper g = new OWLGraphWrapper(pvob.getInferredViewOntology());
		OWLPrettyPrinter pp = new OWLPrettyPrinter(g);
		g.addSupportOntology(pvob.getAssertedViewOntology());
		LOG.info("Building inferred view");
		pvob.buildInferredViewOntology(reasoner);
		boolean ok1 = false;
		int numClassAssertions = 0;

		// iterate through all view entities - this should be the filtered set of view classes plus individuals.
		for (OWLEntity e : pvob.getViewEntities()) {
			if (RENDER_ONTOLOGY_FLAG) {
				LOG.info(" VE: " + e + " LABEL:" + g.getLabel(e));
			}
			if (e instanceof OWLClass) {
				if (g.getLabel(e) != null && g.getLabel(e).equals("involves limb")) {
					ok1 = true;
				}
			}
			else {
				if (e instanceof OWLNamedIndividual) {
					Set<OWLClassAssertionAxiom> caas = pvob.getInferredViewOntology().getClassAssertionAxioms((OWLNamedIndividual) e);

					for (OWLClassAssertionAxiom caa : caas) {
						if (RENDER_ONTOLOGY_FLAG) {
							LOG.info("  CAA:" + pp.render(caa));
						}
						numClassAssertions++;
					}	
				}

			}
		}
		assertTrue(ok1);
		LOG.info("class assertions:"+numClassAssertions);
		//assertEquals(12, numClassAssertions); // TODO - CHECK
		LOG.info(pvob.getViewEntities().size());
		//assertEquals(23, pvob.getViewEntities().size());
	}
	finally {
		reasoner.dispose();
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:82,代码来源:PropertyViewOntologyBuilderTest.java

示例11: createSimpleGraphColoring

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
private OWLOntology createSimpleGraphColoring() {
  	OWLOntology ontoColoring = null;
  	OWLDataFactory factory = OWLManager.getOWLDataFactory();
  	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
  	
  	OWLObjectPropertyExpression edgeProp = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "edge")));
  	OWLClassExpression classNode = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Node")));
  	OWLClassExpression classBlue = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Blue")));
  	OWLClassExpression classRed = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Red")));
  	OWLClassExpression classGreen = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Green")));
  	
  	OWLNamedIndividual indNode1 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node1")));
  	OWLNamedIndividual indNode2 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node2")));
  	OWLNamedIndividual indNode3 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node3")));
  	OWLNamedIndividual indNode4 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node4")));
  	
  	// now the facts
  	// nodes
  	OWLIndividualAxiom axmNodeInst4 =factory.getOWLClassAssertionAxiom(classNode, indNode4);
  	OWLIndividualAxiom axmNodeInst3 =factory.getOWLClassAssertionAxiom(classNode, indNode3);
  	OWLIndividualAxiom axmNodeInst2 =factory.getOWLClassAssertionAxiom(classNode, indNode2);
  	OWLIndividualAxiom axmNodeInst1 =factory.getOWLClassAssertionAxiom(classNode, indNode1);
  	
  	// 1
  	// | \
  	// |  3 - 4
  	// | /
  	// 2
  	//
  	OWLIndividualAxiom axmEdge12 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode2);
  	OWLIndividualAxiom axmEdge13 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode3);
  	OWLIndividualAxiom axmEdge23 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode2, indNode3);
  	OWLIndividualAxiom axmEdge34 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode3, indNode4);
  	
  	// symmetry of edge property
  	OWLObjectPropertyAxiom axmEdgeSym =  factory.getOWLSymmetricObjectPropertyAxiom(edgeProp);
  	
  	// axioms
  	OWLObjectUnionOf exprColorUnion = factory.getOWLObjectUnionOf(classBlue, classRed, classGreen);
  	OWLSubClassOfAxiom axmNodeColorings = factory.getOWLSubClassOfAxiom(classNode, exprColorUnion);
  	
  	// coloring constraints
  	OWLSubClassOfAxiom axmRedConstraint = factory.getOWLSubClassOfAxiom(classRed, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classBlue)));
  	OWLSubClassOfAxiom axmBlueConstraint = factory.getOWLSubClassOfAxiom(classBlue, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classRed)));
  	OWLSubClassOfAxiom axmGreenConstraint = factory.getOWLSubClassOfAxiom(classGreen, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classRed, classBlue)));
  	OWLDisjointClassesAxiom axmDisColors = factory.getOWLDisjointClassesAxiom(classRed, classBlue, classGreen);
  	
  	try {
	ontoColoring = manager.createOntology(); 
	
	manager.addAxiom(ontoColoring, axmNodeInst1);
	manager.addAxiom(ontoColoring, axmNodeInst2);
	manager.addAxiom(ontoColoring, axmNodeInst3);
	manager.addAxiom(ontoColoring, axmNodeInst4);
	
	manager.addAxiom(ontoColoring, axmEdge12);
	manager.addAxiom(ontoColoring, axmEdge13);
	manager.addAxiom(ontoColoring, axmEdge23);
	manager.addAxiom(ontoColoring, axmEdge34);
	
	manager.addAxiom(ontoColoring, axmEdgeSym);
	manager.addAxiom(ontoColoring, axmNodeColorings);
	manager.addAxiom(ontoColoring, axmRedConstraint);
	manager.addAxiom(ontoColoring, axmBlueConstraint);
	manager.addAxiom(ontoColoring, axmGreenConstraint);
	manager.addAxiom(ontoColoring, axmDisColors);
} catch (OWLOntologyCreationException e) {
	e.printStackTrace();
}
  	
  	return ontoColoring;
  }
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:73,代码来源:WolpertingerTest.java

示例12: createNewObjectProperty

import org.semanticweb.owlapi.model.OWLDataFactory; //导入方法依赖的package包/类
private OWLObjectProperty createNewObjectProperty(OWLDataFactory factory, String name) {
	return factory.getOWLObjectProperty(IRI.create(url + name));
}
 
开发者ID:julianmendez,项目名称:jcel,代码行数:4,代码来源:TinyOntologyTest.java


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