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


Java OWLDataFactory.getOWLObjectAllValuesFrom方法代碼示例

本文整理匯總了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;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:25,代碼來源:Reasoner.java

示例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;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:30,代碼來源:Reasoner.java

示例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;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:34,代碼來源:Reasoner.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: 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

示例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;
	}
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:50,代碼來源:Reasoner.java

示例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;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:70,代碼來源:DescriptionTreeSimilarity.java


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