本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectIntersectionOf类的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectIntersectionOf类的具体用法?Java OWLObjectIntersectionOf怎么用?Java OWLObjectIntersectionOf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLObjectIntersectionOf类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLObjectIntersectionOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExplicitDLDisjointnessAxioms
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
/**
* A ^ B -> bottom
* @param reasoner
* @param ontology
* @param cls
* @author Shuo Zhang
* @return
*/
public static OWLClassNodeSet getExplicitDLDisjointnessAxioms(OWLReasoner reasoner, OWLOntology ontology, OWLClass cls){
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
OWLClassExpression subExp;
Set<OWLClassExpression> set;
for (OWLSubClassOfAxiom sax : ontology.getSubClassAxiomsForSuperClass(OWLManager.getOWLDataFactory().getOWLNothing())) {
subExp = sax.getSubClass();
if (subExp instanceof OWLObjectIntersectionOf) {
set = subExp.asConjunctSet();
if (set.contains(cls) && set.size() == 2) {
for (OWLClassExpression op : set) {
if (!op.equals(cls) && !op.isAnonymous()) {
nodeSet.addNode(reasoner.getEquivalentClasses(op));
break;
}
}
}
}
}
return nodeSet;
}
示例2: buildSimpleDefMap
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
private void buildSimpleDefMap() {
simpleDefMap = new HashMap<OWLClass,Set<OWLClassExpression>>();
OWLOntology o = getGraph().getSourceOntology();
for (OWLClass c : o.getClassesInSignature()) {
for (OWLEquivalentClassesAxiom eca : o.getEquivalentClassesAxioms(c)) {
Set<OWLClassExpression> elts = new HashSet<OWLClassExpression>();
for (OWLClassExpression x : eca.getClassExpressions()) {
// assume one logical definitionper class - otherwise choose arbitrary
if (x instanceof OWLObjectIntersectionOf) {
if (getReachableOWLClasses(x, elts) && elts.size() > 0) {
//LOG.info(c+" def= "+elts);
simpleDefMap.put(c, elts);
}
}
}
}
}
}
示例3: getLowestCommonSubsumerClass
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
/**
* generates a LCS expression and makes it a class if it is a class expression
*
* @param a
* @param b
* @return named class representing LCS
*/
public OWLClass getLowestCommonSubsumerClass(OWLClassExpression a, OWLClassExpression b) {
OWLClassExpressionPair pair = new OWLClassExpressionPair(a,b);
if (lcsCache.containsKey(pair)) {
return lcsCache.get(pair);
}
OWLClassExpression x = getLowestCommonSubsumer(a,b);
OWLClass lcs;
if (lcsExpressionToClass.containsKey(x)) {
lcs = lcsExpressionToClass.get(x);
}
if (x instanceof OWLClass)
lcs = (OWLClass)x;
else if (x instanceof OWLObjectIntersectionOf)
lcs = makeClass((OWLObjectIntersectionOf) x);
else
lcs = null;
lcsCache.put(pair, lcs);
return lcs;
}
示例4: expressionToClass
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
private OWLClass expressionToClass(OWLClassExpression x) {
if (x instanceof OWLClass)
return (OWLClass)x;
if (this.expressionToClassMap.containsKey(x))
return this.expressionToClassMap.get(x);
OWLClass c = owlDataFactory.getOWLClass(IRI.create("http://owlsim.org#"+idNum));
idNum++;
OWLEquivalentClassesAxiom eca =
owlDataFactory.getOWLEquivalentClassesAxiom(c, x);
owlOntologyManager.addAxiom(sourceOntology, eca);
expressionToClassMap.put(x, c);
// fully fold tbox (AND and SOME only)
if (x instanceof OWLObjectIntersectionOf) {
for (OWLClassExpression y : ((OWLObjectIntersectionOf)x).getOperands()) {
expressionToClass(y);
}
}
else if (x instanceof OWLObjectSomeValuesFrom) {
expressionToClass(((OWLObjectSomeValuesFrom)x).getFiller());
}
return c;
}
示例5: getLowestCommonSubsumerClass
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
/**
* generates a LCS expression and makes it a class if it is a class expression
*
* @param a
* @param b
* @param leafClasses
* @return named class representing LCS
*/
public OWLClass getLowestCommonSubsumerClass(OWLClassExpression a, OWLClassExpression b, Set<OWLClass> leafClasses) {
OWLClassExpressionPair pair = new OWLClassExpressionPair(a,b);
if (lcsCache.containsKey(pair)) {
return lcsCache.get(pair);
}
OWLClassExpression x = getLowestCommonSubsumer(a,b,leafClasses);
OWLClass lcs;
/*
if (lcsExpressionToClass.containsKey(x)) {
lcs = lcsExpressionToClass.get(x);
}
*/
if (x instanceof OWLClass)
lcs = (OWLClass)x;
else if (x instanceof OWLObjectIntersectionOf)
lcs = makeClass((OWLObjectIntersectionOf) x);
else
lcs = null;
lcsCache.put(pair, lcs);
//LOG.info("LCS of "+a+" + "+b+" = "+lcs);
return lcs;
}
示例6: gatherProperties
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
private void gatherProperties(OWLClassExpression x) {
if (x instanceof OWLClass) {
return;
}
else if (x instanceof OWLObjectIntersectionOf) {
for (OWLClassExpression y : ((OWLObjectIntersectionOf)x).getOperands()) {
gatherProperties(y);
}
}
else if (x instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)x;
gatherProperties(svf.getProperty());
gatherProperties(svf.getFiller());
}
else {
//
}
}
示例7: makeExpression
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
public Expression makeExpression(OWLClassExpression x) {
if (x.isAnonymous()) {
if (x instanceof OWLObjectIntersectionOf) {
return makeIntersectionOf((OWLObjectIntersectionOf)x);
}
else if (x instanceof OWLObjectSomeValuesFrom) {
return makeSomeValuesFrom((OWLObjectSomeValuesFrom)x);
}
else {
return null;
}
}
else {
return makeClassStub(x);
}
}
示例8: visit
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
@Override
public HandlerResult visit(OWLObjectIntersectionOf intersectionOf) {
Set<OWLClassExpression> newOperands = new HashSet<OWLClassExpression>();
boolean changed = false;
for (OWLClassExpression ce : intersectionOf.getOperands()) {
HandlerResult handlerResult = ce.accept(this);
if (handlerResult != null) {
if (handlerResult.remove) {
return HandlerResult.remove();
}
changed = true;
newOperands.add(handlerResult.modified);
}
else {
newOperands.add(ce);
}
}
if (changed) {
if (newOperands.size() == 1) {
return HandlerResult.modified(newOperands.iterator().next());
}
return HandlerResult.modified(factory.getOWLObjectIntersectionOf(newOperands));
}
return null;
}
示例9: handleIntersection
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
private void handleIntersection(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
OWLEquivalentClassesAxiom axiom, OWLObjectIntersectionOf intersection, OWLPrettyPrinter pp)
{
for(OWLClassExpression operand : intersection.getOperandsAsList()) {
OWLClass operandCls = null;
if (!operand.isAnonymous()) {
operandCls = operand.asOWLClass();
}
else if (operand instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) operand;
OWLClassExpression filler = ristriction.getFiller();
if (!filler.isAnonymous()) {
operandCls = filler.asOWLClass();
}
}
else {
// not translatable to OBO
handleGeneric(warnings, allOntologies, axiom, operand, pp);
}
if (operandCls != null && isDangling(operandCls, allOntologies)) {
final IRI iri = operandCls.getIRI();
String message = "Dangling reference "+iri+" in INTERSECTION_OF axiom: "+pp.render(axiom);
warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_INTERSECTION_OF.getTag()));
}
}
}
示例10: getNextPossibleSymptom
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
public String getNextPossibleSymptom() {
OWLClass disease = model.getClass("Disease");
OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
possibleDiseases.remove(model.getDataFactory().getOWLNothing());
Set<OWLClass> possibleSymptoms = new TreeSet<OWLClass>();
Iterator<OWLClass> possibleDiseasesIterator = possibleDiseases.iterator();
while (possibleDiseasesIterator.hasNext()) {
OWLClass next = possibleDiseasesIterator.next();
possibleSymptoms.addAll(model.getSuperOfExpression(next));
}
possibleSymptoms.remove(model.getDataFactory().getOWLThing());
possibleSymptoms.remove(model.getClass("Disease"));
possibleSymptoms.removeAll(selectedSymptoms);
possibleSymptoms.removeAll(notSelectedSymptoms);
System.out.println(possibleDiseases);
if(possibleSymptoms.size()!=0 && possibleDiseases.size()>1)
return (new SimpleShortFormProvider().getShortForm((OWLClass)possibleSymptoms.toArray()[0])).substring(7);
else
return null;
}
示例11: getPossibleDisease
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
public String getPossibleDisease(){
OWLClass disease = model.getClass("Disease");
OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
possibleDiseases.remove(model.getDataFactory().getOWLNothing());
String value="";
if(possibleDiseases.size()!=0) {
Iterator<OWLClass> it = possibleDiseases.iterator();
while (it.hasNext()) {
value+="\n"+new SimpleShortFormProvider().getShortForm(it.next());
}
}else
value+="\nCould not found";
return value;
}
示例12: formatClassExpression
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
public static String formatClassExpression(OWLClassExpression ce,
OWLOntology ont) {
if (ce instanceof OWLClass) {
return getLabel(ce.asOWLClass(), ont);
} else if (ce instanceof OWLObjectIntersectionOf) {
OWLObjectIntersectionOf oi = (OWLObjectIntersectionOf) ce;
List<OWLClassExpression> ops = oi.getOperandsAsList();
StringBuilder sb = new StringBuilder();
sb.append(formatClassExpression(ops.get(0), ont));
for (int i = 1; i < ops.size(); i++) {
sb.append(" \u2229 ");
sb.append(formatClassExpression(ops.get(i), ont));
}
return sb.toString();
} else if (ce instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom osv = (OWLObjectSomeValuesFrom) ce;
OWLObjectPropertyExpression ope = osv.getProperty();
String role = (!ope.isAnonymous()) ? getLabel(
ope.asOWLObjectProperty(), ont) : ope.toString();
return "\u2203" + role + ".("
+ formatClassExpression(osv.getFiller(), ont) + ")";
} else {
return ce.toString();
}
}
示例13: addToOntology
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLClass c1 = featurePool.getExclusiveClass(":ObjectIntersectionOf_QL_Class1");
OWLClass c2 = featurePool.getExclusiveClass(":ObjectIntersectionOf_QL_Class2");
OWLObjectIntersectionOf spork = factory.getOWLObjectIntersectionOf(c1, c2);
OWLClass owlClass = featurePool.getExclusiveClass(":ObjectIntersectionOf_QL");
addAxiomToOntology(factory.getOWLSubClassOfAxiom(owlClass, spork));
}
示例14: addToOntology
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLClass c1 = featurePool.getExclusiveClass(":ObjectIntersectionOf_Class1");
OWLClass c2 = featurePool.getExclusiveClass(":ObjectIntersectionOf_Class2");
OWLObjectIntersectionOf spork = factory.getOWLObjectIntersectionOf(c1, c2);
OWLClass owlClass = featurePool.getExclusiveClass(":ObjectIntersectionOf");
OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(owlClass, spork);
addAxiomToOntology(axiom);
}
示例15: flattenClassExpression
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入依赖的package包/类
private Set<Integer> flattenClassExpression(OWLClassExpression expression, Set<Definition> newDefinitions,
Set<Integer> newNames) {
if (expression instanceof OWLClass) {
return flattenClass((OWLClass) expression, newNames);
}
if (expression instanceof OWLObjectIntersectionOf) {
return flattenConjunction((OWLObjectIntersectionOf) expression, newDefinitions, newNames);
}
if (expression instanceof OWLObjectSomeValuesFrom) {
return flattenExistentialRestriction((OWLObjectSomeValuesFrom) expression, newDefinitions, newNames);
}
throw new RuntimeException("Unsupported class expression: " + expression);
}