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


Java OWLPropertyExpression类代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLPropertyExpression的典型用法代码示例。如果您正苦于以下问题:Java OWLPropertyExpression类的具体用法?Java OWLPropertyExpression怎么用?Java OWLPropertyExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: filterEdges

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
protected void filterEdges(Set<OWLGraphEdge> edges, Set<? extends OWLPropertyExpression> overProperties) {
	Set<OWLGraphEdge> rmEdges = new OWLGraphEdgeSet();
	for (OWLGraphEdge e : edges) {
		if (overProperties != null) {
			if (e.getQuantifiedPropertyList().size() > 1) {
				// if a filter set is provided, do not yield any chains
				rmEdges.add(e);
				continue;					
			}
			OWLQuantifiedProperty qp = e.getSingleQuantifiedProperty();
			if (qp.isSomeValuesFrom() && !overProperties.contains(qp.getProperty())) {
				rmEdges.add(e);
				continue;
			}
		}
		if (isExcludeEdge(e)) {
			rmEdges.add(e);
		}
	}

	edges.removeAll(rmEdges);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:OWLGraphWrapperEdges.java

示例2: testSagaComplex

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
@Test
public void testSagaComplex() throws Exception {
	OWLObject focusObject = g.getOWLClassByIdentifier("GO:0000124"); // SAGA complex
	Set<OWLPropertyExpression> props = new HashSet<OWLPropertyExpression>();
	props.add(g.getOWLObjectProperty(OBOUpperVocabulary.BFO_part_of.getIRI()));
	
	ShuntGraphPair pair = ShuntGraphUtils.createShuntGraphPair(g, focusObject, props, true);
	
	OWLShuntGraph topology = pair.getTopologyGraph();
	
	checkNodesSagaComplex(g, topology);
	checkTopologyRelationsSagaComplex(g, topology);
	
	OWLShuntGraph inferred = pair.getInferredGraph();
	
	checkNodesSagaComplex(g, inferred);
	checkInferredRelationsSagaComplex(g, inferred);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:ShuntGraphUtilsNRTest.java

示例3: testSagaTypeComplexWithChildren

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
@Test
public void testSagaTypeComplexWithChildren() throws Exception {
	OWLObject focusObject = g.getOWLClassByIdentifier("GO:0070461"); // SAGA-type complex
	Set<OWLPropertyExpression> props = new HashSet<OWLPropertyExpression>();
	props.add(g.getOWLObjectProperty(OBOUpperVocabulary.BFO_part_of.getIRI()));
	
	ShuntGraphPair pair = ShuntGraphUtils.createShuntGraphPair(g, focusObject, props, true);
	
	OWLShuntGraph topology = pair.getTopologyGraph();
	
	checkNodesSagaTypeComplexWithChildren(g, topology);
	checkTopologyRelationsSagaTypeComplexWithChildren(g, topology);
	
	OWLShuntGraph inferred = pair.getInferredGraph();
	
	checkNodesSagaTypeComplexWithChildren(g, inferred);
	checkInferredRelationsSagaTypeComplexWithChildren(g, inferred);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:ShuntGraphUtilsNRTest.java

示例4: testSagaTypeComplexWithoutChildren

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
@Test
public void testSagaTypeComplexWithoutChildren() throws Exception {
	OWLObject focusObject = g.getOWLClassByIdentifier("GO:0070461"); // SAGA-type complex
	Set<OWLPropertyExpression> props = new HashSet<OWLPropertyExpression>();
	props.add(g.getOWLObjectProperty(OBOUpperVocabulary.BFO_part_of.getIRI()));
	
	ShuntGraphPair pair = ShuntGraphUtils.createShuntGraphPair(g, focusObject, props, false);
	
	OWLShuntGraph topology = pair.getTopologyGraph();
	
	checkNodesSagaTypeComplexWithoutChildren(g, topology);
	checkTopologyRelationsSagaTypeComplexWithoutChildren(g, topology);
	
	OWLShuntGraph inferred = pair.getInferredGraph();
	
	checkNodesSagaTypeComplexWithoutChildren(g, inferred);
	checkInferredRelationsSagaTypeComplexWithoutChildren(g, inferred);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:ShuntGraphUtilsNRTest.java

示例5: shouldGetOntologyRoots

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * Test {@link OWLGraphWrapperEdgesExtended#getOntologyRoots(Set)} and 
 * {@link OWLGraphWrapperEdgesExtended#getOntologyRoots()}.
 */
@Test
public void shouldGetOntologyRoots() {
	//the ontology has 2 roots, FOO:0001 and FOO:0100
    //NCBITaxon are due to GCI relations
    Set<OWLClass> expectedRoots = new HashSet<OWLClass>(Arrays.asList(
            wrapper.getOWLClassByIdentifier("FOO:0001"), 
            wrapper.getOWLClassByIdentifier("FOO:0100"), 
            wrapper.getOWLClassByIdentifier("NCBITaxon:1"))); 
	assertEquals("Incorrect roots returned", expectedRoots, wrapper.getOntologyRoots());
	
	expectedRoots = new HashSet<OWLClass>(Arrays.asList(
               wrapper.getOWLClassByIdentifier("FOO:0001"), 
               wrapper.getOWLClassByIdentifier("FOO:0100"), 
               wrapper.getOWLClassByIdentifier("NCBITaxon:1"), 
               wrapper.getOWLClassByIdentifier("FOO:0012"), 
               wrapper.getOWLClassByIdentifier("FOO:0007"), 
               wrapper.getOWLClassByIdentifier("FOO:0008"), 
               wrapper.getOWLClassByIdentifier("FOO:0009")));
       assertEquals("Incorrect roots returned", expectedRoots, 
               wrapper.getOntologyRoots(new HashSet<OWLPropertyExpression>(
                   Arrays.asList(wrapper.getOWLObjectPropertyByIdentifier("BFO:0000050")))));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:OWLGraphWrapperEdgesExtendedTest.java

示例6: addSubPropertyAxiom

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
private void addSubPropertyAxiom(OWLSubPropertyAxiom<?> axiom)
{
   OWLPropertyExpression<?,?> subProperty = axiom.getSubProperty();
   OWLPropertyExpression<?,?> superProperty = axiom.getSuperProperty();
   
   OwlNode<OWLPropertyExpression<?,?>> subClassNode = createNode(subProperty);
   OwlNode<OWLPropertyExpression<?,?>> superClassNode = createNode(superProperty);
   
   if (mPropertyCache.contains(subProperty)) {
      subClassNode = findNode(subProperty);
      superClassNode.setParent(subClassNode.getParent());
      subClassNode.setParent(superClassNode);
   }
   else if (mPropertyCache.contains(superProperty)) {
      superClassNode = findNode(superProperty);
      subClassNode.setParent(superClassNode);
   }
   else {
      superClassNode.setParent(mRoot);
      subClassNode.setParent(superClassNode);
   }
   mPropertyCache.add(subProperty);
   mPropertyCache.add(superProperty);
}
 
开发者ID:obidea,项目名称:semantika,代码行数:25,代码来源:OwlPropertyStructureHandler.java

示例7: getAncestors

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
@Override
public OwlNodeSet<OWLPropertyExpression<?, ?>> getAncestors(OWLPropertyExpression<?, ?> entity, boolean direct)
{
   OwlNodeSet<OWLPropertyExpression<?, ?>> ancestors = new OwlNodeSet<OWLPropertyExpression<?, ?>>();
   OwlNode<OWLPropertyExpression<?, ?>> node = mRoot.findNode(entity);
   if (node != null) {
      OwlNode<OWLPropertyExpression<?, ?>> parent = node.getParent();
      while (!parent.isRoot()) {
         ancestors.addNode(parent);
         if (direct) {
            break;
         }
         parent = parent.getParent();
      }
   }
   return ancestors;
}
 
开发者ID:obidea,项目名称:semantika,代码行数:18,代码来源:OwlPropertyStructureHandler.java

示例8: getDescendants

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
@Override
public OwlNodeSet<OWLPropertyExpression<?,?>> getDescendants(OWLPropertyExpression<?,?> entity, boolean direct)
{
   OwlNodeSet<OWLPropertyExpression<?,?>> descendants = new OwlNodeSet<OWLPropertyExpression<?,?>>();
   OwlNode<OWLPropertyExpression<?,?>> node = mRoot.findNode(entity);
   if (node != null) {
      OwlNodeSet<OWLPropertyExpression<?,?>> children = node.getChildren();
      if (direct) {
         descendants.addNodeSet(children);
      }
      else {
         collectChildren(children, descendants);
      }
   }
   return descendants;
}
 
开发者ID:obidea,项目名称:semantika,代码行数:17,代码来源:OwlPropertyStructureHandler.java

示例9: setAndFilterRedundantPredictions

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * side-effects: removes redundant predictions over a set of relationships.
 * If overProps set is empty, only the subClassOf hierarchy is used, if it's
 * null all relationships are used.
 * 
 * @param predictions
 * @param aClasses
 * @param overProps
 */
protected void setAndFilterRedundantPredictions(Set<Prediction> predictions, Set<OWLClass> aClasses, Set<OWLPropertyExpression> overProps) {
	Set<Prediction> newPredictions = new HashSet<Prediction>();

	for (Prediction p : predictions) {
		boolean isRedundant = false;
		GeneAnnotation a = p.getGeneAnnotation();
		OWLClass cls = (OWLClass) graph.getOWLObjectByIdentifier(a.getCls());
		for (OWLClass aClass : aClasses) {
			if (graph.getAncestorsReflexive(aClass, overProps).contains(cls)) {
				isRedundant = true;
				break;
			}
		}
		if (isRedundant && this.removeAllRedundant) {
			continue;
		}
		p.setRedundantWithExistingAnnotations(isRedundant);
		
		isRedundant = false;
		for (Prediction p2 : predictions) {
			GeneAnnotation a2 = p2.getGeneAnnotation();
			OWLClass cls2 = (OWLClass) graph.getOWLObjectByIdentifier(a2.getCls());
			if (graph.getAncestors(cls2).contains(cls)) {
				isRedundant = true;
				break;
			}
		}
		if (isRedundant && this.removeAllRedundant) {
			continue;
		}
		p.setRedundantWithOtherPredictions(isRedundant);
		newPredictions.add(p);
	}
	predictions.clear();
	predictions.addAll(newPredictions);

}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:47,代码来源:AbstractAnnotationPredictor.java

示例10: classifyRelationship

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * Classify the an edge and target as a human readable string for further processing.
 * 
 * @param owlGraphEdge edge under consideration
 * @param edgeDirector 
 * @param props properties set
 * @return null, "simplesubclass", "typesubclass", or "identity".
 * @see #addDirectDescendentsToShuntGraph
 * @see #addStepwiseAncestorsToShuntGraph
 */
public String classifyRelationship(OWLGraphEdge owlGraphEdge, OWLObject edgeDirector, Set<? extends OWLPropertyExpression> props){		
	String retval = null;
	
	OWLQuantifiedProperty qp = owlGraphEdge.getSingleQuantifiedProperty();
	if( qp.isSubClassOf() || props.contains(qp.getProperty()) ){
		//OWLObject target = owlGraphEdge.getTarget();
		if( edgeDirector instanceof OWLClass ){
			retval = "simplesubclass";
		}else if( edgeDirector instanceof OWLObjectSomeValuesFrom ){
			OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom)edgeDirector;
			if( props.contains(some.getProperty()) ){
				OWLClassExpression clsexp = some.getFiller();
				if( ! clsexp.isAnonymous()){
					retval = "typesubclass";
				}
			}
		}
	}else if( qp.isIdentity() ){
		retval = "identity";
	}else{
		if (LOG.isDebugEnabled()) {
			LOG.debug("Skipping complex edge: "+owlGraphEdge);
		}
	}
	
	return retval;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:38,代码来源:OWLGraphWrapperEdgesAdvanced.java

示例11: findLeastCommonAncestors

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * Find lest common ancestors to {@code x} and {@code y} that can be reached 
 * over the specified set of relations. 
 * @param g
 * @param x
 * @param y
 * @param overProps
 * @return
 */
public static Set<OWLObject> findLeastCommonAncestors(OWLGraphWrapper g,
        OWLObject x, OWLObject y, Set<OWLPropertyExpression> overProps) {
    Set<OWLObject> cas = findCommonAncestors(g,x,y, overProps);
    Set<OWLObject> lcas = new HashSet<OWLObject>();
    lcas.addAll(cas);
    for (OWLObject z : cas) {
        lcas.removeAll(g.getAncestors(z, overProps));
    }
    return lcas;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OWLGraphUtil.java

示例12: getOutgoingEdges

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * retrieves direct edges from a source
 * to the direct **named** target for a given set of properties
 * <ul>
 * <li>e.g. if (A SubClassOf B) then outgoing(A) = { &lt;A,sub,B&gt;}</li>
 * <li>e.g. if (A SubClassOf R some B) then outgoing(A) = { &lt;A, R-some, B&gt; }</li>
 * <li>e.g. if (A SubClassOf R some (R2 some B)) then outgoing(A) = { &lt;A, [R-some,R2-same], B&gt; }</li>
 * </ul>
 * @param cls source
 * @param props
 * @return all edges that originate from source to nearest named object target
 */
public Set<OWLGraphEdge> getOutgoingEdges(OWLObject cls, Set<? extends OWLPropertyExpression> props) {
	Set<OWLGraphEdge> pEdges = getPrimitiveOutgoingEdges(cls);
	LOG.debug("primitive edges:"+cls+" --> "+pEdges);

	Set<OWLGraphEdge> edges = new OWLGraphEdgeSet();
	for (OWLGraphEdge e : pEdges) {
	    edges.addAll(primitiveEdgeToFullEdges(e));
	}
       if (props != null) {
           filterEdges(edges, props);
       }
	LOG.debug("  all:"+cls+" --> "+edges);
	return edges;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:OWLGraphWrapperEdges.java

示例13: getAncestors

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * As {@link getAncestors(OWLObject s, Set<OWLProperty) overProps}, 
 * but if isStrict is true, then only consider paths that include at least one edge
 * with a property in the specified set. i.e. exclude subclass-only paths. 
 * 
 * @param s
 * @param overProperties
 * @return
 */

public Set<OWLObject> getAncestors(OWLObject x, Set<OWLPropertyExpression> overProps, boolean isStrict) {
	Set<OWLObject> ancs = new HashSet<OWLObject>();
	for (OWLGraphEdge e : getOutgoingEdgesClosure(x, overProps)) {
		boolean isAddMe = false;
		if (overProps != null) {
			List<OWLQuantifiedProperty> qps = e.getQuantifiedPropertyList();
			if (qps.size() == 0) {
				// identity
				if (!isStrict)
					isAddMe = true;
			}
			else if (qps.size() == 1) {
				OWLQuantifiedProperty qp = qps.get(0);
				if (qp.isIdentity()) {
					if (!isStrict)
						isAddMe = true;
				}
				else if (qp.isSubClassOf()) {
					if (!isStrict)
						isAddMe = true;
				}
				else if (qp.isSomeValuesFrom() && overProps.contains(qp.getProperty())) {
					isAddMe = true;
				}
			}
			else if (!isStrict) {
			    isAddMe = true;
			}
		}
		else {
			isAddMe = true;
		}
		if (isAddMe)
			ancs.add(e.getTarget());
	}
	return ancs;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:48,代码来源:OWLGraphWrapperEdges.java

示例14: shouldGetGCIAncestorsOverProps

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
/**
 * Test {@link OWLGraphWrapperEdgesExtended#getNamedAncestorsWithGCI(OWLClass, Set)}.
 */
@SuppressWarnings("rawtypes")
@Test
public void shouldGetGCIAncestorsOverProps() throws OWLOntologyCreationException, 
OBOFormatParserException, IOException {
    ParserWrapper parserWrapper = new ParserWrapper();
    OWLOntology ont = parserWrapper.parse(this.getClass().getResource(
            "/graph/gciRelRetrieval.obo").getFile());
    OWLGraphWrapper wrapper = new OWLGraphWrapper(ont);
    
    OWLClass cls8 = wrapper.getOWLClassByIdentifier("ID:8");
    OWLClass cls6 = wrapper.getOWLClassByIdentifier("ID:6");
    OWLClass cls4 = wrapper.getOWLClassByIdentifier("ID:4");
    OWLClass cls5 = wrapper.getOWLClassByIdentifier("ID:5");
    OWLClass cls9 = wrapper.getOWLClassByIdentifier("ID:9");
    OWLClass cls10 = wrapper.getOWLClassByIdentifier("ID:10");
    
    Set<OWLClass> expectedAncestors = new HashSet<OWLClass>();
    Set<OWLPropertyExpression> overProps = new HashSet<OWLPropertyExpression>();
    overProps.add(wrapper.getOWLObjectPropertyByIdentifier("BFO:0000050"));
    //no ancestors through GCI
    expectedAncestors.add(cls4);
    expectedAncestors.add(cls6);
    assertEquals("Incorrect ancestors with GCI over props", expectedAncestors, 
            wrapper.getNamedAncestorsWithGCI(cls8, overProps));
    //ancestors with GCI
    expectedAncestors = new HashSet<OWLClass>();
    overProps = new HashSet<OWLPropertyExpression>();
    overProps.add(wrapper.getOWLObjectPropertyByIdentifier("RO:0002202"));
    expectedAncestors.add(cls10);
    expectedAncestors.add(cls6);
    expectedAncestors.add(cls5);
    assertEquals("Incorrect ancestors through GCI and classical relations", 
            expectedAncestors, wrapper.getNamedAncestorsWithGCI(cls9, overProps));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:38,代码来源:OWLGraphWrapperEdgesExtendedTest.java

示例15: collectChildren

import org.semanticweb.owlapi.model.OWLPropertyExpression; //导入依赖的package包/类
private static void collectChildren(OwlNodeSet<OWLPropertyExpression<?,?>> children, OwlNodeSet<OWLPropertyExpression<?,?>> descendants)
{
   if (children.isEmpty()) {
      return;
   }
   descendants.addNodeSet(children);
   OwlNodeSet<OWLPropertyExpression<?,?>> newChildren = new OwlNodeSet<OWLPropertyExpression<?,?>>();
   for (OwlNode<OWLPropertyExpression<?,?>> node : children.getNodes()) {
      newChildren.addNodeSet(node.getChildren());
   }
   collectChildren(newChildren, descendants);
}
 
开发者ID:obidea,项目名称:semantika,代码行数:13,代码来源:OwlPropertyStructureHandler.java


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