@Override public double getRelevance(OWLEntity entity, OWLClassExpression desc){ Set<OWLEntity> entities = desc.getSignature(); double score = 0; for (OWLEntity otherEntity : entities) { double relevance = getRelevance(entity, otherEntity); if(!Double.isInfinite(relevance)){ score += relevance/entities.size(); } } return score; }
object.put("descriptionManchesterSyntax", OWLAPIRenderers.toManchesterOWLSyntax(hypothesis)); JSONArray array = new JSONArray(); for (OWLEntity entity : hypothesis.getSignature()) { array.put(entity.toStringID());
public OWLClassExpression visit(OWLObjectAllValuesFrom desc) { if (signature.containsAll(desc.getFiller().getSignature())) { OWLClass name = createNewName(); OWLClassExpression rhs = desc.getFiller().accept(this); axioms.add(getSCA(name, rhs)); return df.getOWLObjectAllValuesFrom(desc.getProperty(), name); } else { return desc; } }
public OWLClassExpression visit(OWLObjectExactCardinality desc) { if (signature.containsAll(desc.getFiller().getSignature())) { OWLClass name = createNewName(); OWLClassExpression rhs = desc.getFiller().accept(this); axioms.add(getSCA(name, rhs)); return df.getOWLObjectExactCardinality(desc.getCardinality(), desc.getProperty(), name); } else { return desc; } }
public OWLClassExpression visit(OWLObjectMaxCardinality desc) { if (signature.containsAll(desc.getFiller().getSignature())) { OWLClass name = createNewName(); OWLClassExpression rhs = desc.getFiller().accept(this); axioms.add(getSCA(name, rhs)); return df.getOWLObjectMaxCardinality(desc.getCardinality(), desc.getProperty(), name); } else { return desc; } }
indent + " signature = " + expr.getSignature());
/** * Determines if a class description contains any unreferenced entities with * respect to the ontology that contains the entailments which are being * explained. * * @param desc * The description to be searched * @return <code>true</code> if the description references entities that * the ontology that contains entailments which are being explained, * otherwise <code>false</code> */ public static boolean containsUnreferencedEntity(OWLOntology ontology, OWLClassExpression desc) { for( OWLEntity entity : desc.getSignature() ) { if( !ontology.containsEntityInSignature( entity ) ) { if( entity instanceof OWLClass && (((OWLClass) entity).isOWLThing() || ((OWLClass) entity).isOWLNothing()) ) { continue; } return true; } } return false; }
public OWLClassExpression visit(OWLObjectMinCardinality desc) { if (signature.containsAll(desc.getFiller().getSignature())) { OWLClass name = createNewName(); OWLClassExpression rhs = desc.getFiller().accept(this); axioms.add(getSCA(name, rhs)); return df.getOWLObjectMinCardinality(desc.getCardinality(), desc.getProperty(), name); } else { return desc; } }
/** * Determines if a class description contains any unreferenced entities with * respect to the ontology that contains the entailments which are being * explained. * * @param desc * The description to be searched * @return <code>true</code> if the description references entities that * the ontology that contains entailments which are being explained, * otherwise <code>false</code> */ public static boolean containsUnreferencedEntity(OWLOntology ontology, OWLClassExpression desc) { for( OWLEntity entity : desc.getSignature() ) { if( !ontology.containsEntityInSignature( entity ) ) { if( entity instanceof OWLClass && (((OWLClass) entity).isOWLThing() || ((OWLClass) entity).isOWLNothing()) ) { continue; } return true; } } return false; }
if (sce.getSignature().contains(dataFactory.getOWLThing())) { logger.debug("Ignoring: " + sce); continue; if (sce.getSignature().contains(c)) { logger.debug("Signature contains base class: " + sce); continue;
/** * Uses a module with OWL 2 Reasoner to check if a class expression "c" is satisfiable */ private boolean checkSatisfiability(OWLClassExpression c) { SyntacticLocalityModuleExtractor botModExtractor = new SyntacticLocalityModuleExtractor( manager, ontology, ModuleType.BOT); Set<OWLEntity> signature = new HashSet<OWLEntity>(); signature.addAll(c.getSignature()); boolean isSat = true; try { OWLReasoner auxOWLReasoner = OWL2ReasonerManager.createOWL2ReasonerInstance( botModExtractor.extractAsOntology( signature, IRI.create("http://org.semanticweb.more.orechallenge/moduleForSatisfiability")), OWL2REASONERID); isSat = auxOWLReasoner.isSatisfiable(c); auxOWLReasoner.dispose(); } catch (OWLOntologyCreationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return isSat; }
Collection<OWLClassExpression> superClasses) { for (OWLClassExpression sc : superClasses) { if (objects.containsAll(sc.getSignature())) { Map<String, OWLClassExpression> classPair = new HashMap<>(); classPair.put(SUB, cls);
Set<OWLClassExpression> sces = emr.getSuperClassExpressions(c, true); for (OWLClassExpression sce : sces) { if (!sce.getSignature().contains(dataFactory.getOWLThing())) { OWLAxiom ax = dataFactory.getOWLSubClassOfAxiom(c, sce); logger.debug("NEW:" + ax);
Set<OWLEntity> signature = patternSuperClass.getSignature(); signature.remove(patternSubClass.asOWLClass()); Query query = converter.asQuery("?x", dataFactory.getOWLObjectIntersectionOf(cls, patternSuperClass), signature);
Set<OWLEntity> entities = expression.getSignature();