本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLObjectAllValuesFrom方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLObjectAllValuesFrom方法的具體用法?Java OWLDataFactory.getOWLObjectAllValuesFrom怎麽用?Java OWLDataFactory.getOWLObjectAllValuesFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLObjectAllValuesFrom方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isReflexive
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isReflexive(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 freshIndividual = factory
.getOWLAnonymousIndividual("fresh-individual");
OWLAxiom pseudoNominalAssertion = factory.getOWLClassAssertionAxiom(
pseudoNominal, freshIndividual);
OWLAxiom allNotPseudoNominalAssertion = factory
.getOWLClassAssertionAxiom(allNotPseudoNominal, freshIndividual);
Tableau tableau = getTableau(pseudoNominalAssertion,
allNotPseudoNominalAssertion);
boolean result = tableau.isSatisfiable(true, null, null, null, null,
null, new ReasoningTaskDescription(true, "symmetry of {0}",
H(propertyExpression)));
tableau.clearAdditionalDLOntology();
return !result;
}
示例2: 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;
}
示例3: 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;
}
示例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;
}
示例5: 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;
}
示例6: 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;
}
}
示例7: 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;
}