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


Java OWLObjectSomeValuesFrom.getProperty方法代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectSomeValuesFrom.getProperty方法的具体用法?Java OWLObjectSomeValuesFrom.getProperty怎么用?Java OWLObjectSomeValuesFrom.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom的用法示例。


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

示例1: hasLinks

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * Check that the given subClass does not already has a matching subClass axiom.
 * 
 * @param subCls
 * @param p
 * @param superCls
 * @return existing axiom or null
 */
private OWLAxiom hasLinks(OWLClass subCls, OWLObjectProperty p, OWLClass superCls) {
	for(OWLOntology o : allOntologies) {
		Set<OWLSubClassOfAxiom> subClsAxioms = o.getSubClassAxiomsForSubClass(subCls);
		for (OWLSubClassOfAxiom subClsAxiom : subClsAxioms) {
			OWLClassExpression ce = subClsAxiom.getSuperClass();
			if (ce instanceof OWLObjectSomeValuesFrom) {
				OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = someValuesFrom.getProperty();
				if (p.equals(property)) {
					OWLClassExpression filler = someValuesFrom.getFiller();
					if (superCls.equals(filler)) {
						return subClsAxiom;
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:28,代码来源:LinkMaker.java

示例2: renderAdditionalNodeExpression

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp, OWLGraphWrapper graph) {
	if (expression instanceof OWLObjectSomeValuesFrom) {
		OWLObjectSomeValuesFrom object = (OWLObjectSomeValuesFrom) expression;
		OWLObjectPropertyExpression property = object.getProperty();
		OWLClassExpression filler = object.getFiller();
		line.append("<TR><TD>");
		line.append(getLabel(property, owlpp, graph));
		line.append("</TD><TD>");
		line.append(getLabel(filler, owlpp, graph));
		line.append("</TD></TR>");
	}
	else {
		line.append("<TR><TD COLSPAN=\"2\">");
		line.append(getLabel(expression, owlpp, graph));
		line.append("</TD></TR>");
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:LegoShuntGraphTool.java

示例3: renderAdditionalNodeExpression

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp) {
	if (expression instanceof OWLObjectSomeValuesFrom) {
		OWLObjectSomeValuesFrom object = (OWLObjectSomeValuesFrom) expression;
		OWLObjectPropertyExpression property = object.getProperty();
		OWLClassExpression filler = object.getFiller();
		line.append("<TR><TD>");
		line.append(getLabel(property, owlpp));
		line.append("</TD><TD>");
		line.append(getLabel(filler, owlpp));
		line.append("</TD></TR>");
	}
	else {
		line.append("<TR><TD COLSPAN=\"2\">");
		line.append(getLabel(expression, owlpp));
		line.append("</TD></TR>");
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:LegoDotWriter.java

示例4: flattenExistentialRestriction

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private Set<Integer> flattenExistentialRestriction(OWLObjectSomeValuesFrom existentialRestriction,
		Set<Definition> newDefinitions, Set<Integer> newNames) {
	OWLObjectPropertyExpression propertyExpr = existentialRestriction.getProperty();
	if (propertyExpr.isAnonymous()) {
		throw new RuntimeException("Unsupported object property expression: " + propertyExpr);
	}

	String roleName = propertyExpr.getNamedProperty().toStringID();
	Set<Integer> fillerIds = flattenClassExpression(existentialRestriction.getFiller(), newDefinitions, newNames);
	Integer fillerId = null;

	if (fillerIds.size() == 0) {
		// the empty conjunction is top
		fillerId = atomManager.createConceptName(top.toStringID());
	} else if (fillerIds.size() == 1) {
		fillerId = fillerIds.iterator().next();
	}

	if ((fillerId == null) || !atomManager.getAtom(fillerId).isConceptName()) {
		// if we have more than one atom id in 'fillerIds' or the only atom
		// id is not a concept name, then we need to introduce a new
		// definition in order to obtain a flat atom
		fillerId = createFreshFlatteningDefinition(fillerIds, newDefinitions);
	}

	Integer atomId = atomManager.createExistentialRestriction(roleName, fillerId);
	return Collections.singleton(atomId);
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:29,代码来源:UelOntology.java

示例5: generateLabel

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
public String generateLabel(OWLClassExpression x) {
	StringBuffer sb = new StringBuffer();
	if (x instanceof OWLObjectSomeValuesFrom) {
		OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) x;	
		OWLObjectPropertyExpression p = svf.getProperty();
		if (propertyToFormatMap.containsKey(p)) {
			return String.format(propertyToFormatMap.get(p), generateLabel(svf.getFiller()));
		}
		else {
			String pStr = p.toString();
			if (p instanceof OWLEntity) {
				pStr = getAnyLabel((OWLEntity)p);
			}
			return pStr + " some "+generateLabel(svf.getFiller());
		}
	}
	else if (x instanceof OWLObjectIntersectionOf) {
		OWLObjectIntersectionOf oio = (OWLObjectIntersectionOf) x;
		for (OWLClassExpression op : oio.getOperands()) {
			if (sb.length() > 0) {
				sb.append(" and ");
			}
			sb.append(generateLabel(op));
		}
		return sb.toString();
	}
	else if (x instanceof OWLClass) {
		return this.getAnyLabel((OWLClass) x);
	}
	return x.toString();
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:32,代码来源:AbstractSimPreProcessor.java

示例6: nameObjectSomeValuesFrom

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * Names all inner ObjectSomeValuesFrom expressions
 * 
 * @param srcOntology
 * @param tgtOntology
 * @param qmap
 * @param isAddLabels
 * @return
 */
public static Map<OWLClass, OWLClassExpression> nameObjectSomeValuesFrom(OWLOntology srcOntology,
		OWLOntology tgtOntology,
		Map<OWLClass,OWLClassExpression> qmap,
		boolean isAddLabels) {

	if (qmap == null) 
		qmap = new HashMap<OWLClass, OWLClassExpression>();
	OWLOntologyManager mgr = srcOntology.getOWLOntologyManager();
	OWLDataFactory df = mgr.getOWLDataFactory();
	for (OWLOntology ont : srcOntology.getImportsClosure()) {
		for (OWLAxiom ax : srcOntology.getAxioms()) {
			for (OWLClassExpression x : ax.getNestedClassExpressions()) {
				if (x instanceof OWLObjectSomeValuesFrom) {
					OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)x;
					OWLClass filler = (OWLClass) svf.getFiller();
					OWLObjectProperty p = (OWLObjectProperty) svf.getProperty();
					IRI iri = getSkolemIRI(filler, p);
					OWLClass c = df.getOWLClass(iri);
					mgr.addAxiom(tgtOntology, df.getOWLEquivalentClassesAxiom(c, svf));
					qmap.put(c, svf);
					if (isAddLabels) {
						Set<OWLAnnotation> anns = OwlHelper.getAnnotations(filler, df.getRDFSLabel(), ont);
						for (OWLAnnotation ann : anns) {
							mgr.addAxiom(tgtOntology, df.getOWLAnnotationAssertionAxiom(c.getIRI(), ann));
						}
					}
				}
			}
		}
	}
	return qmap;

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

示例7: checkPotentialRedundantSubClassAxioms

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * Check all classes for potential redundant subClass axioms of type:
 * <pre>
 *   A SubClassOf R some B
 *    and
 *   A SubClassOf B
 * </pre>
 * 
 * @return list of axiom pairs
 */
public List<PotentialRedundant> checkPotentialRedundantSubClassAxioms() {
	List<PotentialRedundant> result = new ArrayList<PotentialRedundant>();
	for(OWLClass cls : graph.getAllOWLClasses()) {
		Set<OWLSubClassOfAxiom> axioms = graph.getAllOWLSubClassOfAxiomsForSubClass(cls);
		if (axioms.size() > 1) {
			// only check sets with more than one axiom
			for (OWLSubClassOfAxiom main : axioms) {
				OWLClassExpression mainSuperClassCE = main.getSuperClass();
				if (mainSuperClassCE.isAnonymous()) {
					continue;
				}
				OWLClass mainSuperClass = mainSuperClassCE.asOWLClass();
				for (OWLSubClassOfAxiom current : axioms) {
					if (main == current) {
						continue;
					}
					OWLClassExpression currentSuperClass = current.getSuperClass();
					if (currentSuperClass.isAnonymous() && currentSuperClass instanceof OWLObjectSomeValuesFrom) {
						OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) currentSuperClass;
						final OWLClassExpression filler = someValuesFrom.getFiller();
						if (mainSuperClass.equals(someValuesFrom.getFiller())) {
							final OWLObjectPropertyExpression property = someValuesFrom.getProperty();
							final OWLClassExpression subClass = current.getSubClass();
							final PotentialRedundant redundant = new PotentialRedundant(main, current, subClass.asOWLClass(), property.asOWLObjectProperty(), filler.asOWLClass());
							result.add(redundant);
						}
					}
				}
			}
		}
	}
	
	if (!result.isEmpty()) {
		return result;
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:48,代码来源:InferenceBuilder.java

示例8: visit

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * According to the naive translation:<br/>
 * <br/>
 * <code>naive(Exists r.A) := not r(X,Y), A(Y)</code>
 *
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom)
 */

public void visit(OWLObjectSomeValuesFrom objExistential) {
	// we require normalized axioms, therefore we can do the following
	OWLObjectPropertyExpression property = objExistential.getProperty();
	OWLClassExpression fillerClass = objExistential.getFiller();

	OWLObjectMinCardinality minCard = new OWLObjectMinCardinalityImpl(property, 1, fillerClass);
	visit(minCard);
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:17,代码来源:DebugTranslation.java

示例9: getConceptForSomeValuesFrom

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * Returns the concept for some values from.
 *
 * @param expr the expr
 * @param ontology the ontology
 * @param level the level
 * @return the concept for some values from
 * @throws Exception the exception
 */
private Concept getConceptForSomeValuesFrom(OWLObjectSomeValuesFrom expr,
  OWLOntology ontology, int level) throws Exception {
  String uuid = TerminologyUtility.getUuid(expr.toString()).toString();

  if (idMap.containsKey(uuid)) {
    return getConcept(idMap.get(uuid));
  }

  Concept concept = new ConceptJpa();
  setCommonFields(concept);
  concept.setWorkflowStatus(WorkflowStatus.PUBLISHED);
  concept.setAnonymous(true);
  concept.setTerminologyId(uuid);
  concept.setName(expr.toString());
  concept.setUsesRelationshipIntersection(true);
  concept.setUsesRelationshipUnion(false);

  // This is a restriction on a property with existential quantification.
  // It is a relationship to either a class or an anonymous class

  // Get the target concept
  Concept concept2 =
      getConceptForOwlClassExpression(expr.getFiller(), ontology, level + 1);
  // Add if anonymous and doesn't exist yet
  if (concept2.isAnonymous()
      && !idMap.containsKey(concept2.getTerminologyId())) {
    addAnonymousConcept(concept2);
    exprMap.put(concept2.getTerminologyId(), expr);
  }

  // Get the property and create a relationship
  OWLObjectProperty property = (OWLObjectProperty) expr.getProperty();
  ConceptRelationship rel = new ConceptRelationshipJpa();
  setCommonFields(rel);
  rel.setWorkflowStatus(WorkflowStatus.PUBLISHED);
  rel.setRelationshipType("other");
  rel.setAdditionalRelationshipType(
      relaMap.get(getTerminologyId(property.getIRI())).getAbbreviation());
  rel.setFrom(concept);
  rel.setTo(concept2);
  concept.getRelationships().add(rel);

  return concept;
}
 
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:54,代码来源:OwlLoaderAlgorithm.java

示例10: removeRedundantInferredSVFs

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
@CLIMethod("--remove-redundant-inferred-svfs")
public void removeRedundantInferredSVFs(Opts opts) throws Exception {
    opts.info("", "removes redundant existentials using extended reasoner");
    if (g == null) {
        LOG.error("No current ontology loaded");
        exit(-1);
    }
    if (reasoner == null) {
        LOG.error("No reasoner available for the current ontology");
        exit(-1);
    }
    if (!(reasoner instanceof OWLExtendedReasoner)) {
        LOG.error("Reasoner is not extended");
        exit(-1);
    }
    OWLExtendedReasoner exr = (OWLExtendedReasoner)reasoner;
    while (opts.hasOpts()) {
        if (opts.nextEq("--report-file")) {
            //reportFile = opts.nextOpt();
        }
        else {
            break;
        }
    }
    OWLPrettyPrinter owlpp = new OWLPrettyPrinter(g);
    Set<OWLSubClassOfAxiom> axioms = g.getSourceOntology().getAxioms(AxiomType.SUBCLASS_OF);
    Set<OWLSubClassOfAxiom> rmAxioms = new HashSet<OWLSubClassOfAxiom>();
    LOG.info("Candidates: " + axioms.size());
    int n = 0;
    for (OWLSubClassOfAxiom axiom : axioms) {
        n++;
        if (n % 100 == 0) {
            LOG.info("Testing axiom #" +n);
        }
        if (axiom.getSubClass().isAnonymous())
            continue;
        OWLClass subClass = (OWLClass)axiom.getSubClass();
        if (axiom.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
            OWLObjectSomeValuesFrom svf = ((OWLObjectSomeValuesFrom)axiom.getSuperClass());
            if (svf.getProperty().isAnonymous())
                continue;
            if (svf.getFiller().isAnonymous())
                continue;
            OWLObjectProperty p = (OWLObjectProperty)svf.getProperty();
            Set<OWLClass> directParents = exr.getSuperClassesOver(subClass, p, true);
            if (!directParents.contains(svf.getFiller())) {
                rmAxioms.add(axiom);
                LOG.info("  IS_REDUNDANT: "+owlpp.render(axiom)+" as filler not in "+directParents);
                for (OWLClass dp : directParents) {
                    LOG.info("DIRECT_PARENT_OVER "+owlpp.render(p)+" "+owlpp.render(dp));
                }
            }
        }
    }
    g.getManager().removeAxioms(g.getSourceOntology(), rmAxioms);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:57,代码来源:CommandRunner.java

示例11: expand

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的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

示例12: retainAxiomsInPropertySubset

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的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

示例13: getSubClassOfSomeValuesFromAxioms

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
 * Generates trivial SVF axioms from existing GCIs
 * 
 * <pre>
 * For each GCI of the form CX SubClassOf R some DX
 *  for each C that is an inferred direct subclass of or equivalent to CX
 *     for each D that is an inferred direct superclass of or equivalent to DX
 *       add an axiom C SubClassOf R some D
 * </pre>
 * @param ontology
 * @param reasoner
 * @return axioms
 */
public static Set<OWLSubClassOfAxiom> getSubClassOfSomeValuesFromAxioms(OWLOntology ontology,
		OWLReasoner reasoner) {

	Set<OWLSubClassOfAxiom> axioms = new HashSet<OWLSubClassOfAxiom>();
	OWLDataFactory df = ontology.getOWLOntologyManager().getOWLDataFactory();
	for (OWLSubClassOfAxiom ax : ontology.getAxioms(AxiomType.SUBCLASS_OF)) {
		OWLClassExpression c = ax.getSubClass();
		if (ax.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)ax.getSuperClass();
			OWLObjectPropertyExpression p = svf.getProperty();
			OWLClassExpression filler = svf.getFiller();
			if (filler.isAnonymous() || c.isAnonymous()) {
				if (c.isBottomEntity())
					continue;
				if (filler.isTopEntity())
					continue;
				
				Set<OWLClass> childSet = reasoner.getEquivalentClasses(c).getEntities();
				if (childSet.size() == 0) {
					childSet = reasoner.getSubClasses(c, true).getFlattened();
				}
				for (OWLClass childClass : childSet) {
					if (childClass.isBottomEntity())
						continue;
					Set<OWLClass> childClassSuperClasses = 
							reasoner.getSuperClasses(childClass, false).getFlattened();
					childClassSuperClasses.addAll(reasoner.getEquivalentClasses(childClass).getEntities());
					Set<OWLClass> parentSet = reasoner.getEquivalentClasses(filler).getEntities();
					if (parentSet.size() == 0) {
						parentSet = reasoner.getSuperClasses(filler, true).getFlattened();
					}
					// TODO: remove additional redundancy (R some X) SubClassOf (R some Y)
					// Elk cannot test arbitrary entailments
						for (OWLClass parentClass : parentSet) {
						if (parentClass.isTopEntity())
							continue;
						
						// do not assert C SubClassOf part-of some D, if C SubClassOf D is entailed
						if (childClassSuperClasses.contains(parentClass))
							continue;
						axioms.add(df.getOWLSubClassOfAxiom(childClass, 
								df.getOWLObjectSomeValuesFrom(p, parentClass)));
					}
				}
			}

		}
	}
	LOG.info("Inferred SVFs: "+axioms.size());
	return axioms;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:65,代码来源:GCIUtil.java

示例14: getLabel

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private String getLabel(OWLClassExpression expression, OWLPrettyPrinter owlpp, OWLGraphWrapper graph) {
	if (expression instanceof OWLClass) {
		return graph.getLabelOrDisplayId(expression);
	}
	else if (expression instanceof OWLObjectIntersectionOf) {
		StringBuilder sb = new StringBuilder();
		OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) expression;
		sb.append("<TABLE>");
		for (OWLClassExpression ce : intersectionOf.getOperands()) {
			sb.append("<TR><TD>");
			if (ce instanceof OWLClass) {
				sb.append(graph.getLabelOrDisplayId((OWLClass)ce));
			}
			else if (ce instanceof OWLObjectSomeValuesFrom){
				OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = some.getProperty();
				if (property.isAnonymous()) {
					sb.append(owlpp.render(property));
				}
				else {
					sb.append(graph.getLabelOrDisplayId(property.asOWLObjectProperty()));
				}
				sb.append(" <B>some</B> ");
				OWLClassExpression filler = some.getFiller();
				if (filler instanceof OWLClass) {
					sb.append(graph.getLabelOrDisplayId((OWLClass)filler));
				}
				else {
					sb.append(owlpp.render(filler));
				}
			}
			else {
				sb.append(ce.toString());
			}
			sb.append("</TD></TR>");
		}
		sb.append("</TABLE>");
		return sb.toString();
	}
	return owlpp.render(expression);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:LegoShuntGraphTool.java

示例15: getLabel

import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private CharSequence getLabel(OWLClassExpression expression, OWLPrettyPrinter owlpp) {
	if (expression instanceof OWLClass) {
		return insertLineBrakes(graph.getLabelOrDisplayId(expression));
	}
	else if (expression instanceof OWLObjectIntersectionOf) {
		StringBuilder sb = new StringBuilder();
		OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) expression;
		sb.append("<TABLE>");
		for (OWLClassExpression ce : intersectionOf.getOperands()) {
			sb.append("<TR><TD>");
			if (ce instanceof OWLClass) {
				sb.append(insertLineBrakes(graph.getLabelOrDisplayId((OWLClass)ce)));
			}
			else if (ce instanceof OWLObjectSomeValuesFrom){
				OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = some.getProperty();
				if (property.isAnonymous()) {
					sb.append(owlpp.render(property));
				}
				else {
					sb.append(insertLineBrakes(graph.getLabelOrDisplayId(property.asOWLObjectProperty())));
				}
				sb.append(" <B>some</B> ");
				OWLClassExpression filler = some.getFiller();
				if (filler instanceof OWLClass) {
					sb.append(insertLineBrakes(graph.getLabelOrDisplayId((OWLClass)filler)));
				}
				else {
					sb.append(insertLineBrakes(escape(owlpp.render(filler))));
				}
			}
			else {
				sb.append(insertLineBrakes(escape(ce.toString())));
			}
			sb.append("</TD></TR>");
		}
		sb.append("</TABLE>");
		return sb.toString();
	}
	return insertLineBrakes(escape(owlpp.render(expression)));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:LegoDotWriter.java


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