public static OWLAxiom getClosureAxiom(OWLClass cls, OWLObjectProperty prop, OWLDataFactory df, Set<OWLOntology> onts) { ClosureAxiomFactory fac = new ClosureAxiomFactory(prop, df, onts); cls.accept(fac); final OWLObjectAllValuesFrom closure = fac.getClosureRestriction(); return (closure != null) ? df.getOWLSubClassOfAxiom(cls, closure) : null; }
public void visit(OWLObjectExactCardinality restr) { handleCardinality(restr); }
/** * Gets a universal restriction (<code>OWLObjectAllValuesFrom</code>) that * closes off the existential restrictions that have been visited by this * visitor. For example, if the visitor had visited p some A, p some B, then * the restriction p only (A or B) would be returned. * @return A universal restriction that represents a closure axiom for visited * restrictions, or <code>null</code> if no existential restrictions have been * visited by this visitor and a universal closure axiom therefore doesn't make * sense. */ public OWLObjectAllValuesFrom getClosureRestriction() { Set<OWLClassExpression> descriptions = getFillers(); if (descriptions.isEmpty()) { return null; } else { if (descriptions.size() == 1) { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), descriptions.iterator().next()); } else { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), owlDataFactory.getOWLObjectUnionOf(descriptions)); } } }
public void visit(OWLObjectSomeValuesFrom restr) { if (restr.getProperty().equals(getObjectProperty())){ OWLClassExpression filler = restr.getFiller(); if (!filler.equals(owlDataFactory.getOWLThing())) { fillers.add(filler); } } }
public void actionPerformed(ActionEvent e) { List<OWLOntologyChange> changes = new ArrayList<>(); final OWLOntology activeOnt = getOWLModelManager().getActiveOntology(); final Set<OWLOntology> activeOnts = getOWLModelManager().getActiveOntologies(); final OWLDataFactory df = getOWLModelManager().getOWLDataFactory(); final OWLClass root = getRootObject(); for (OWLObjectProperty prop : getPropertiesFromSelection()){ OWLAxiom ax = ClosureAxiomFactory.getClosureAxiom(root, prop, df, activeOnts); if (ax != null && !activeOnt.containsAxiom(ax)){ changes.add(new AddAxiom(activeOnt, ax)); } } if (!changes.isEmpty()){ getOWLModelManager().applyChanges(changes); } }
/** * Gets a universal restriction (<code>OWLObjectAllValuesFrom</code>) that * closes off the existential restrictions that have been visited by this * visitor. For example, if the visitor had visited p some A, p some B, then * the restriction p only (A or B) would be returned. * * @return A universal restriction that represents a closure axiom for visited * restrictions, or <code>null</code> if no existential restrictions have been * visited by this visitor and a universal closure axiom therefore doesn't make * sense. */ public OWLObjectAllValuesFrom getClosureRestriction() { Set<OWLClassExpression> descriptions = getFillers(); if (descriptions.isEmpty()) { return null; } else { if (descriptions.size() == 1) { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), descriptions.iterator().next()); } else { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), owlDataFactory.getOWLObjectUnionOf(descriptions)); } } }
public void visit(OWLObjectSomeValuesFrom restr) { if (restr.getProperty().equals(getObjectProperty())) { OWLClassExpression filler = restr.getFiller(); if (!filler.equals(owlDataFactory.getOWLThing())) { fillers.add(filler); } } }
public void actionPerformed(ActionEvent e) { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); final OWLOntology activeOnt = getOWLModelManager().getActiveOntology(); final Set<OWLOntology> activeOnts = getOWLModelManager().getActiveOntologies(); final OWLDataFactory df = getOWLModelManager().getOWLDataFactory(); final OWLClass root = getRootObject(); for (OWLObjectProperty prop : getPropertiesFromSelection()){ OWLAxiom ax = ClosureAxiomFactory.getClosureAxiom(root, prop, df, activeOnts); if (ax != null && !activeOnt.containsAxiom(ax)){ changes.add(new AddAxiom(activeOnt, ax)); } } if (!changes.isEmpty()){ getOWLModelManager().applyChanges(changes); } }
public static OWLAxiom getClosureAxiom(OWLClass cls, OWLObjectProperty prop, OWLDataFactory df, Set<OWLOntology> onts){ ClosureAxiomFactory fac = new ClosureAxiomFactory(prop, df, onts); cls.accept(fac); final OWLObjectAllValuesFrom closure = fac.getClosureRestriction(); return (closure != null) ? df.getOWLSubClassOfAxiom(cls, closure) : null; }
/** * Gets a universal restriction (<code>OWLObjectAllValuesFrom</code>) that * closes off the existential restrictions that have been visited by this * visitor. For example, if the visitor had visited p some A, p some B, then * the restriction p only (A or B) would be returned. * * @return A universal restriction that represents a closure axiom for visited * restrictions, or <code>null</code> if no existential restrictions have been * visited by this visitor and a universal closure axiom therefore doesn't make * sense. */ public OWLObjectAllValuesFrom getClosureRestriction() { Set<OWLClassExpression> descriptions = getFillers(); if (descriptions.isEmpty()) { return null; } else { if (descriptions.size() == 1) { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), descriptions.iterator().next()); } else { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), owlDataFactory.getOWLObjectUnionOf(descriptions)); } } }
public void visit(OWLObjectSomeValuesFrom restr) { if (restr.getProperty().equals(getObjectProperty())) { OWLClassExpression filler = restr.getFiller(); if (!filler.equals(owlDataFactory.getOWLThing())) { fillers.add(filler); } } }
public void visit(OWLObjectMinCardinality restr) { handleCardinality(restr); }
public void actionPerformed(ActionEvent e) { List<OWLOntologyChange> changes = new ArrayList<>(); final OWLOntology activeOnt = getOWLModelManager().getActiveOntology(); final Set<OWLOntology> activeOnts = getOWLModelManager().getActiveOntologies(); final OWLDataFactory df = getOWLModelManager().getOWLDataFactory(); final OWLClass root = getRootObject(); for (OWLObjectProperty prop : getPropertiesFromSelection()){ OWLAxiom ax = ClosureAxiomFactory.getClosureAxiom(root, prop, df, activeOnts); if (ax != null && !activeOnt.containsAxiom(ax)){ changes.add(new AddAxiom(activeOnt, ax)); } } if (!changes.isEmpty()){ getOWLModelManager().applyChanges(changes); } }
public static OWLAxiom getClosureAxiom(OWLClass cls, OWLObjectProperty prop, OWLDataFactory df, Set<OWLOntology> onts) { ClosureAxiomFactory fac = new ClosureAxiomFactory(prop, df, onts); cls.accept(fac); final OWLObjectAllValuesFrom closure = fac.getClosureRestriction(); return (closure != null) ? df.getOWLSubClassOfAxiom(cls, closure) : null; }
/** * Gets a universal restriction (<code>OWLObjectAllValuesFrom</code>) that * closes off the existential restrictions that have been visited by this * visitor. For example, if the visitor had visited p some A, p some B, then * the restriction p only (A or B) would be returned. * @return A universal restriction that represents a closure axiom for visited * restrictions, or <code>null</code> if no existential restrictions have been * visited by this visitor and a universal closure axiom therefore doesn't make * sense. */ public OWLObjectAllValuesFrom getClosureRestriction() { Set<OWLClassExpression> descriptions = getFillers(); if (descriptions.isEmpty()) { return null; } else { if (descriptions.size() == 1) { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), descriptions.iterator().next()); } else { return owlDataFactory.getOWLObjectAllValuesFrom(getObjectProperty(), owlDataFactory.getOWLObjectUnionOf(descriptions)); } } }
public void visit(OWLObjectSomeValuesFrom restr) { if (restr.getProperty().equals(getObjectProperty())){ OWLClassExpression filler = restr.getFiller(); if (!filler.equals(owlDataFactory.getOWLThing())) { fillers.add(filler); } } }
public void visit(OWLObjectMinCardinality restr) { handleCardinality(restr); }
public void actionPerformed(ActionEvent e) { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); final OWLOntology activeOnt = getOWLModelManager().getActiveOntology(); final Set<OWLOntology> activeOnts = getOWLModelManager().getActiveOntologies(); final OWLDataFactory df = getOWLModelManager().getOWLDataFactory(); final OWLClass root = getRootObject(); for (OWLObjectProperty prop : getPropertiesFromSelection()){ OWLAxiom ax = ClosureAxiomFactory.getClosureAxiom(root, prop, df, activeOnts); if (ax != null && !activeOnt.containsAxiom(ax)){ changes.add(new AddAxiom(activeOnt, ax)); } } if (!changes.isEmpty()){ getOWLModelManager().applyChanges(changes); } }
public static OWLAxiom getClosureAxiom(OWLClass cls, OWLObjectProperty prop, OWLDataFactory df, Set<OWLOntology> onts){ ClosureAxiomFactory fac = new ClosureAxiomFactory(prop, df, onts); cls.accept(fac); final OWLObjectAllValuesFrom closure = fac.getClosureRestriction(); return (closure != null) ? df.getOWLSubClassOfAxiom(cls, closure) : null; }
private void handleCardinality(OWLObjectCardinalityRestriction restr) { if (restr.getProperty().equals(getObjectProperty()) && restr.getCardinality() > 0) { OWLClassExpression filler = restr.getFiller(); if (!filler.equals(owlDataFactory.getOWLThing())) { fillers.add(filler); } } } }