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


Java OWLDataFactory.getOWLObjectSomeValuesFrom方法代碼示例

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


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

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
 * Adds a ClassAssertion, where the class expression instantiated is an
 * ObjectSomeValuesFrom expression
 * 
 * Example: Individual: i Type: enabledBy some PRO_123
 *  
 * @param model
 * @param i
 * @param p
 * @param filler
 * @param metadata
 */
void addType(ModelContainer model,
		OWLIndividual i, 
		OWLObjectPropertyExpression p,
		OWLClassExpression filler,
		METADATA metadata) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Adding "+i+ " type "+p+" some "+filler);	
	}
	OWLDataFactory f = model.getOWLDataFactory();
	OWLObjectSomeValuesFrom c = f.getOWLObjectSomeValuesFrom(p, filler);
	OWLClassAssertionAxiom axiom = f.getOWLClassAssertionAxiom(c, i);
	addAxiom(model, axiom, metadata);
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:26,代碼來源:CoreMolecularModelManager.java

示例3: addSomeValuesFromClassAssertion

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void addSomeValuesFromClassAssertion(OWLOntology ont,
		OWLIndividual i, OWLClass j, OWLObjectProperty p) {
	OWLDataFactory df = ont.getOWLOntologyManager().getOWLDataFactory();
	OWLObjectSomeValuesFrom svf = 
			df.getOWLObjectSomeValuesFrom(p, j);
	addAxiom(ont, df.getOWLClassAssertionAxiom(svf, i));
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:8,代碼來源:OWLHandler.java

示例4: visit

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Override
public OWLAxiom visit(GCI2Axiom axiom) {
	Objects.requireNonNull(axiom);
	OWLClass owlSubClass = translator.getTranslationRepository().getOWLClass(axiom.getSubClass());
	OWLClass owlClassInSuperClass = translator.getTranslationRepository().getOWLClass(axiom.getClassInSuperClass());
	OWLObjectProperty owlObjectProperty = translator.getTranslationRepository()
			.getOWLObjectProperty(axiom.getPropertyInSuperClass());
	Set<OWLAnnotation> owlAnnotations = translateAnnotations(axiom.getAnnotations());
	OWLDataFactory dataFactory = ontology.getOWLOntologyManager().getOWLDataFactory();
	OWLClassExpression owlObjectSomeValuesFrom = dataFactory.getOWLObjectSomeValuesFrom(owlObjectProperty,
			owlClassInSuperClass);
	return dataFactory.getOWLSubClassOfAxiom(owlSubClass, owlObjectSomeValuesFrom, owlAnnotations);
}
 
開發者ID:julianmendez,項目名稱:jcel,代碼行數:14,代碼來源:ReverseAxiomTranslator.java

示例5: expand

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
 * Create the GCIs for BioChEBI. Add the axioms into the given ontology.
 * 
 * @param ontology
 * @param ignoredClasses
 */
public void expand(OWLOntology ontology, Set<OWLClass> ignoredClasses) {
	final OWLOntologyManager manager = ontology.getOWLOntologyManager();
	final OWLDataFactory factory = manager.getOWLDataFactory();
	
	// scan axioms
	Set<OWLSubClassOfAxiom> axioms = ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED);
	for (OWLSubClassOfAxiom axiom : axioms) {
		OWLClassExpression superCE = axiom.getSuperClass();
		OWLClassExpression subCE = axiom.getSubClass();
		if (subCE.isAnonymous()) {
			// sub class needs to be an named OWLClass
			continue;
		}

		if (superCE instanceof OWLObjectSomeValuesFrom == false) {
			continue;
		}
		OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) superCE;

		OWLObjectPropertyExpression expression = some.getProperty();
		if (expression.isAnonymous()) {
			// object property expression needs to be a named OWLObjectProperty 
			continue;
		}

		OWLObjectProperty p = (OWLObjectProperty) expression;
		
		Set<OWLObjectProperty> expansions = expansionMap.get(p);
		if (expansions == null) {
			continue;
		}

		// get content for GCI
		OWLClassExpression y = some.getFiller();
		OWLClass x = subCE.asOWLClass();
		if (ignoredClasses.contains(x)) {
			continue;
		}
		for (OWLObjectProperty createProperty : expansions) {
			OWLClassExpression ce1 = factory.getOWLObjectSomeValuesFrom(createProperty, x);
			OWLClassExpression ce2 = factory.getOWLObjectSomeValuesFrom(createProperty, y);
			OWLEquivalentClassesAxiom eq = factory.getOWLEquivalentClassesAxiom(ce1, ce2);
			manager.addAxiom(ontology, eq);
		}
	}
	
	Set<OWLOntology> imports = ontology.getImports();
	StringBuilder sb = new StringBuilder();
	DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	sb.append("Generated on ").append(dateFormat.format(new Date())).append(" using the following import chain:");
	for (OWLOntology owlOntology : imports) {
		OWLOntologyID ontologyID = owlOntology.getOntologyID();
		sb.append(" ");
		appendOntologyId(ontologyID, sb);
	}
	addComment(sb.toString(), ontology);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:64,代碼來源:BioChebiGenerator.java

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

示例7: retainAxiomsInPropertySubset

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
 * given an ontology *ont* and a set of object properties *filterProps*, remove all axioms from ontology that
 * have an object property P in their signature where P is not in *filterProps*
 * 
 * @param ont
 * @param filterProps
 * @param reasoner
 */
public static void retainAxiomsInPropertySubset(OWLOntology ont, Set<OWLObjectProperty> filterProps, OWLReasoner reasoner) {
	LOG.info("Removing axioms that use properties not in set: "+filterProps);
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
	OWLDataFactory df = ont.getOWLOntologyManager().getOWLDataFactory();
	for (OWLAxiom ax : ont.getAxioms()) {
		Set<OWLObjectProperty> ps = ax.getObjectPropertiesInSignature();
		ps.removeAll(filterProps);
		if (ps.size() > 0) {
			rmAxioms.add(ax);

			// if p not-in SubSet, and
			//  A = X SubClassOf p Some Y,
			// then rewrite as
			//  A = X SubClassOf p' some Y, where p' SubPropertyOf p
			// rewrite as weaker axioms.
			// TOOD - Elk does not support superobjectprops - do in wrapper for now?
			if (ax instanceof OWLSubClassOfAxiom) {
			    OWLSubClassOfAxiom sca = (OWLSubClassOfAxiom)ax;
			    if (!sca.getSubClass().isAnonymous()) {
			        if (sca.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
			            OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) sca.getSuperClass();
			            OWLObjectPropertyExpression p = svf.getProperty();
			            Set<OWLObjectPropertyExpression> sps = 
			                    getSuperObjectProperties(p, reasoner, ont);
			            sps.retainAll(filterProps);
			            for (OWLObjectPropertyExpression sp : sps) {
			                OWLObjectSomeValuesFrom newSvf = df.getOWLObjectSomeValuesFrom(sp, svf.getFiller());
			                OWLSubClassOfAxiom newSca = df.getOWLSubClassOfAxiom(sca.getSubClass(), newSvf);
			                LOG.info("REWRITE: "+sca+" --> "+newSca);
			                newAxioms.add(newSca);
			            }
			        }
			    }
			}
			//else if (ax instanceof OWLEquivalentClassesAxiom) {
			//	((OWLEquivalentClassesAxiom)ax).getClassExpressions();
			//}
			
		}
	}
	LOG.info("Removing "+rmAxioms.size()+" axioms");
	ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
	LOG.info("Adding "+newAxioms.size()+" axioms");
	ont.getOWLOntologyManager().addAxioms(ont, newAxioms);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:55,代碼來源:Mooncat.java

示例8: createDisjoint

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
 * @param f
 * @param sibling1
 * @param sibling2
 * @param property
 * @return axiom
 */
protected OWLAxiom createDisjoint(OWLDataFactory f,	OWLClass sibling1, OWLClass sibling2, OWLObjectProperty property) {
	OWLClassExpression ce1 = f.getOWLObjectSomeValuesFrom(property, sibling1);
	OWLClassExpression ce2 = f.getOWLObjectSomeValuesFrom(property, sibling2);
	return f.getOWLDisjointClassesAxiom(ce1, ce2);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:13,代碼來源:TaxonCommandRunner.java


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