private OWLDescription createIncludeCoffeeDescription(Set<OWLClass> includeExtras) { OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras Set<OWLDescription> classes = new HashSet<OWLDescription>(); classes.add(getCoffeeClass()); // get OWL class for Coffee for (OWLClass extra : includeExtras) { classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } return manager.getOWLDataFactory().getOWLObjectIntersectionOf(classes); }
private OWLDescription createExcludeCoffeeDescription(Set<OWLClass> excludeExtras) { OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras Set<OWLDescription> classes = new HashSet<OWLDescription>(); // Everything must be a coffee for (OWLClass extra : excludeExtras) { classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } // are looking for. return manager.getOWLDataFactory().getOWLObjectUnionOf(classes); }
/** * Creates OWLDescription (query) by given included extras and excluded extras * * @param includeExtras * @param excludeExtras * @return */ private OWLDescription createCoffeeDescription( Set<OWLClass> includeExtras, Set<OWLClass> excludeExtras) { // Include means existential restrictions // Exclude means negated existential restrictions OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras // Create a hash set to store the components (existential restrictions) // of our description Set<OWLDescription> classes = new HashSet<OWLDescription>(); // Everything must be a coffee classes.add(getCoffeeClass()); // get OWL class for Coffee // Create the existential restrictions that represent the extras // that we want to include. for (OWLClass extra : includeExtras) { // e.g. hasExtras some ex_A , hasExtras some ex_B classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } // Create the negated existential restrictions of the extras that we // want to exclude for (OWLClass excludeExtra : excludeExtras) { // has_topping some topping_A OWLDescription restriction = manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, excludeExtra); // not (has_topping some topping_A) OWLObjectComplementOf neg = manager.getOWLDataFactory().getOWLObjectComplementOf(restriction); classes.add(neg); } // Bind the whole thing up in an intersection class // to create a concept description of the coffee we // are looking for. return manager.getOWLDataFactory().getOWLObjectIntersectionOf(classes); }
public OWLObjectProperty getExtrasProperty() { return getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); }