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


Java OWLDataFactory.getOWLObjectPropertyAssertionAxiom方法代碼示例

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


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

示例1: removeFact

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public Set<IRI> removeFact(ModelContainer model, OWLObjectPropertyExpression p,
		OWLIndividual i, OWLIndividual j, METADATA metadata) {
	OWLDataFactory f = model.getOWLDataFactory();
	
	OWLOntology ont = model.getAboxOntology();
	OWLAxiom toRemove = null;
	Set<IRI> iriSet = new HashSet<IRI>();
	Set<OWLObjectPropertyAssertionAxiom> candidates = ont.getObjectPropertyAssertionAxioms(i);
	for (OWLObjectPropertyAssertionAxiom axiom : candidates) {
		if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
			toRemove = axiom;
			extractEvidenceIRIValues(axiom.getAnnotations(), iriSet);
			break;
		}
	}
	if (toRemove == null) {
		// fall back solution
		toRemove = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
	}
	removeAxiom(model, toRemove, metadata);
	return iriSet;
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:23,代碼來源:CoreMolecularModelManager.java

示例2: isAsymmetric

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isAsymmetric(
		OWLObjectPropertyExpression propertyExpression) {
	checkPreConditions(propertyExpression);
	if (!m_isConsistent)
		return true;
	OWLDataFactory factory = getDataFactory();
	OWLIndividual freshIndividualA = factory
			.getOWLAnonymousIndividual("fresh-individual-A");
	OWLIndividual freshIndividualB = factory
			.getOWLAnonymousIndividual("fresh-individual-B");
	OWLAxiom assertion1 = factory.getOWLObjectPropertyAssertionAxiom(
			propertyExpression, freshIndividualA, freshIndividualB);
	OWLAxiom assertion2 = factory.getOWLObjectPropertyAssertionAxiom(
			propertyExpression.getInverseProperty(), freshIndividualA,
			freshIndividualB);
	Tableau tableau = getTableau(assertion1, assertion2);
	boolean result = tableau.isSatisfiable(true, null, null, null, null,
			null, new ReasoningTaskDescription(true, "asymmetry of {0}",
					H(propertyExpression)));
	tableau.clearAdditionalDLOntology();
	return !result;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:23,代碼來源:Reasoner.java

示例3: createFact

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
 * @param f
 * @param p
 * @param i
 * @param j
 * @param annotations
 * @return axiom
 */
public static OWLObjectPropertyAssertionAxiom createFact(OWLDataFactory f,
		OWLObjectPropertyExpression p, OWLIndividual i, OWLIndividual j,
		Set<OWLAnnotation> annotations) {
	final OWLObjectPropertyAssertionAxiom axiom;
	if (annotations != null && !annotations.isEmpty()) {
		axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j, annotations);	
	}
	else {
		axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
	}
	return axiom;
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:21,代碼來源:CoreMolecularModelManager.java

示例4: modifyAnnotations

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private OWLObjectPropertyAssertionAxiom modifyAnnotations(OWLObjectPropertyAssertionAxiom axiom, 
		Set<OWLAnnotation> replacement, 
		ModelContainer model, METADATA metadata) {
	OWLOntology ont = model.getAboxOntology();
	OWLDataFactory f = model.getOWLDataFactory();
	List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(2);
	changes.add(new RemoveAxiom(ont, axiom));
	OWLObjectPropertyAssertionAxiom newAxiom = 
			f.getOWLObjectPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), axiom.getObject(), replacement);
	changes.add(new AddAxiom(ont, newAxiom));
	applyChanges(model, changes, metadata);
	return newAxiom;
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:14,代碼來源:CoreMolecularModelManager.java

示例5: isSymmetric

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isSymmetric(OWLObjectPropertyExpression propertyExpression) {
	checkPreConditions(propertyExpression);
	if (!m_isConsistent
			|| propertyExpression.getNamedProperty()
					.isOWLTopObjectProperty())
		return true;
	OWLDataFactory factory = getDataFactory();
	OWLClass pseudoNominal = factory.getOWLClass(IRI
			.create("internal:pseudo-nominal"));
	OWLClassExpression allNotPseudoNominal = factory
			.getOWLObjectAllValuesFrom(propertyExpression,
					pseudoNominal.getObjectComplementOf());
	OWLIndividual freshIndividualA = factory
			.getOWLAnonymousIndividual("fresh-individual-A");
	OWLIndividual freshIndividualB = factory
			.getOWLAnonymousIndividual("fresh-individual-B");
	OWLAxiom assertion1 = factory.getOWLObjectPropertyAssertionAxiom(
			propertyExpression, freshIndividualA, freshIndividualB);
	OWLAxiom assertion2 = factory.getOWLClassAssertionAxiom(
			allNotPseudoNominal, freshIndividualB);
	OWLAxiom assertion3 = factory.getOWLClassAssertionAxiom(pseudoNominal,
			freshIndividualA);
	Tableau tableau = getTableau(assertion1, assertion2, assertion3);
	boolean result = tableau.isSatisfiable(true, null, null, null, null,
			null, new ReasoningTaskDescription(true, "symmetry of {0}",
					propertyExpression));
	tableau.clearAdditionalDLOntology();
	return !result;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:30,代碼來源:Reasoner.java

示例6: isTransitive

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isTransitive(
		OWLObjectPropertyExpression propertyExpression) {
	checkPreConditions(propertyExpression);
	if (!m_isConsistent)
		return true;
	OWLDataFactory factory = getDataFactory();
	OWLClass pseudoNominal = factory.getOWLClass(IRI
			.create("internal:pseudo-nominal"));
	OWLClassExpression allNotPseudoNominal = factory
			.getOWLObjectAllValuesFrom(propertyExpression,
					pseudoNominal.getObjectComplementOf());
	OWLIndividual freshIndividualA = factory
			.getOWLAnonymousIndividual("fresh-individual-A");
	OWLIndividual freshIndividualB = factory
			.getOWLAnonymousIndividual("fresh-individual-B");
	OWLIndividual freshIndividualC = factory
			.getOWLAnonymousIndividual("fresh-individual-C");
	OWLAxiom assertion1 = factory.getOWLObjectPropertyAssertionAxiom(
			propertyExpression, freshIndividualA, freshIndividualB);
	OWLAxiom assertion2 = factory.getOWLObjectPropertyAssertionAxiom(
			propertyExpression, freshIndividualB, freshIndividualC);
	OWLAxiom assertion3 = factory.getOWLClassAssertionAxiom(
			allNotPseudoNominal, freshIndividualA);
	OWLAxiom assertion4 = factory.getOWLClassAssertionAxiom(pseudoNominal,
			freshIndividualC);
	Tableau tableau = getTableau(assertion1, assertion2, assertion3,
			assertion4);
	boolean result = tableau.isSatisfiable(true, null, null, null, null,
			null, new ReasoningTaskDescription(true, "transitivity of {0}",
					H(propertyExpression)));
	tableau.clearAdditionalDLOntology();
	return !result;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:34,代碼來源:Reasoner.java

示例7: isSubObjectPropertyExpressionOf

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isSubObjectPropertyExpressionOf(
		OWLObjectPropertyExpression subObjectPropertyExpression,
		OWLObjectPropertyExpression superObjectPropertyExpression) {
	checkPreConditions(subObjectPropertyExpression,
			superObjectPropertyExpression);
	if (!m_isConsistent
			|| subObjectPropertyExpression.getNamedProperty()
					.isOWLBottomObjectProperty()
			|| superObjectPropertyExpression.getNamedProperty()
					.isOWLTopObjectProperty())
		return true;
	Role subrole = H(subObjectPropertyExpression);
	Role superrole = H(superObjectPropertyExpression);
	if (m_objectRoleHierarchy != null
			&& !containsFreshEntities(subObjectPropertyExpression,
					superObjectPropertyExpression)) {
		HierarchyNode<Role> subroleNode = m_objectRoleHierarchy
				.getNodeForElement(subrole);
		return subroleNode.isEquivalentElement(superrole)
				|| subroleNode.isAncestorElement(superrole);
	} else {
		OWLDataFactory factory = getDataFactory();
		OWLClass pseudoNominal = factory.getOWLClass(IRI
				.create("internal:pseudo-nominal"));
		OWLClassExpression allSuperNotPseudoNominal = factory
				.getOWLObjectAllValuesFrom(superObjectPropertyExpression,
						pseudoNominal.getObjectComplementOf());
		OWLIndividual freshIndividualA = factory
				.getOWLAnonymousIndividual("fresh-individual-A");
		OWLIndividual freshIndividualB = factory
				.getOWLAnonymousIndividual("fresh-individual-B");
		OWLAxiom subObjectPropertyAssertion = factory
				.getOWLObjectPropertyAssertionAxiom(
						subObjectPropertyExpression, freshIndividualA,
						freshIndividualB);
		OWLAxiom pseudoNominalAssertion = factory
				.getOWLClassAssertionAxiom(pseudoNominal, freshIndividualB);
		OWLAxiom allSuperNotPseudoNominalAssertion = factory
				.getOWLClassAssertionAxiom(allSuperNotPseudoNominal,
						freshIndividualA);
		Tableau tableau = getTableau(subObjectPropertyAssertion,
				pseudoNominalAssertion, allSuperNotPseudoNominalAssertion);
		boolean result = tableau.isSatisfiable(true, null, null, null,
				null, null, ReasoningTaskDescription.isRoleSubsumedBy(
						subrole, superrole, true));
		tableau.clearAdditionalDLOntology();
		return !result;
	}
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:50,代碼來源:Reasoner.java

示例8: 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


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