public static FilterConstraint getDelegateConstraint(OWLOntology configuration, OWLIndividual i) { Collection<OWLIndividual> subFilters = i.getObjectPropertyValues(HAS_SERVER_FILTER, configuration); if (subFilters == null || subFilters.size() == 0) { return null; } if (subFilters.size() > 1) { logger.warning("Filter specification " + i + " specifies more than one delegate constraint. Some of the specification may be lost."); } return new FilterConstraint(configuration, subFilters.iterator().next()); }
@Override public Collection<IIndividual> getIndividuals(IProperty property) { List<IIndividual> ret = new ArrayList<>(); for (OWLIndividual ind : individual.getObjectPropertyValues(((Property)property)._owl.asOWLObjectProperty(), ontology)) { ret.add(new Individual(ind, context)); } return ret; }
public ServerConstraints(OWLOntology configuration, OWLIndividual serverIndividual) { this.serverIndividual = serverIndividual; containingFilterConstraint = FilterConstraint.getDelegateConstraint(configuration, serverIndividual); Set<OWLIndividual> transports = serverIndividual.getObjectPropertyValues(HAS_TRANSPORT, configuration); if (transports != null) { for (OWLIndividual transport : transports) { transportConstraints.add(new TransportConstraints(configuration, transport)); } } }
@Override public Collection<IProperty> getObjectRelationships() { List<IProperty> ret = new ArrayList<>(); Map<OWLObjectPropertyExpression, Set<OWLIndividual>> pvals = individual.getObjectPropertyValues(ontology); for (OWLObjectPropertyExpression p : pvals.keySet()) { IProperty prop = ((Concept)concept)._manager.getPropertyFor(p.asOWLObjectProperty().getIRI()); if (prop != null) { ret.add(prop); } } return ret; }
/** * Utility method to get all the values of a property from a Library subject * * @param ontology * @param individualIRI * @param op * @return */ private static String[] getLibraryObjectPropertyValues(OWLOntology ontology, String individualIRI, OWLObjectProperty op) { Set<OWLIndividual> scopes = cLibrary.getIndividuals(ontology); List<String> result = new ArrayList<String>(); for (OWLIndividual iLibrary : scopes) { if (iLibrary.isNamed()) { if (((OWLNamedIndividual) iLibrary).getIRI().toString().equals(individualIRI)) { Set<OWLIndividual> values = iLibrary.getObjectPropertyValues(op, ontology); Iterator<OWLIndividual> it = values.iterator(); while (it.hasNext()) { OWLIndividual i = it.next(); if (i.isNamed()) result.add(((OWLNamedIndividual) iLibrary).getIRI().toString()); } } } } return result.toArray(EMPTY_IRI_ARRAY); }
/** * Utility method to get all the values of a property from a Library subject * * @param ontology * @param individualIRI * @param op * @return */ private static String[] getLibraryObjectPropertyValues(OWLOntology ontology, String individualIRI, OWLObjectProperty op) { Set<OWLIndividual> scopes = cLibrary.getIndividuals(ontology); List<String> result = new ArrayList<String>(); for (OWLIndividual iLibrary : scopes) { if (iLibrary.isNamed()) { if (((OWLNamedIndividual) iLibrary).getIRI().toString().equals(individualIRI)) { Set<OWLIndividual> values = iLibrary.getObjectPropertyValues(op, ontology); Iterator<OWLIndividual> it = values.iterator(); while (it.hasNext()) { OWLIndividual i = it.next(); if (i.isNamed()) result.add(((OWLNamedIndividual) iLibrary).getIRI().toString()); } } } } return result.toArray(EMPTY_IRI_ARRAY); }
/** * Utility method to get all the values of a property from a Library subject * * @param ontology * @param individualIRI * @param op * @return */ private static String[] getLibraryObjectPropertyValues( OWLOntology ontology, String individualIRI, OWLObjectProperty op) { Set<OWLIndividual> scopes = cLibrary.getIndividuals(ontology); List<String> result = new ArrayList<String>(); for (OWLIndividual iLibrary : scopes) { if (iLibrary.isNamed()) { if (((OWLNamedIndividual) iLibrary).getIRI().toString().equals( individualIRI)) { Set<OWLIndividual> values = iLibrary .getObjectPropertyValues(op, ontology); Iterator<OWLIndividual> it = values.iterator(); while (it.hasNext()) { OWLIndividual i = it.next(); if (i.isNamed()) result.add(((OWLNamedIndividual) iLibrary).getIRI() .toString()); } } } } return result.toArray(EMPTY_IRI_ARRAY); }
if (iScope.isNamed()) { if (((OWLNamedIndividual) iScope).getIRI().toString().equals(individualIRI)) { Set<OWLIndividual> values = iScope.getObjectPropertyValues(op, ontology);
if (((OWLNamedIndividual) iScope).getIRI().toString().equals( individualIRI)) { Set<OWLIndividual> values = iScope.getObjectPropertyValues( op, ontology);
/*Load your ontology from a local file and do the initialisations*/ File inputfile = new File("ontologyPath"); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); ; OWLDataFactory dataFactory = manager.getOWLDataFactory(); OWLOntology yourOntology = manager.loadOntologyFromOntologyDocument(inputfile); IRI ontologyIRI = yourOntology.getOntologyID().getOntologyIRI(); /*Get the object property and the individual you're interested in*/ OWLObjectProperty o_p_responsible_for = dataFactory.getOWLObjectProperty(IRI.create(ontologyIRI + "#"+"Responsiblefor")); OWLIndividual ind_Wayne = dataFactory.getOWLNamedIndividual(IRI.create(ontologyIRI + "#"+"Wayne_Smith")); /*return the value*/ Set<OWLIndividual> responsibilities_of_Wayne= ind_Wayne.getObjectPropertyValues(o_p_responsible_for, yourOntology);
if (iScope.isNamed()) { if (((OWLNamedIndividual) iScope).getIRI().toString().equals(individualIRI)) { Set<OWLIndividual> values = iScope.getObjectPropertyValues(op, ontology);
if (ind instanceof OWLIndividual) { for (OWLIndividual value : ((OWLIndividual) ind).getObjectPropertyValues(isOntologyOf, o)) if (value.isNamed()) libs.add(value.asOWLNamedIndividual());
if (ind instanceof OWLIndividual) { for (OWLIndividual value : ((OWLIndividual) ind).getObjectPropertyValues(isOntologyOf, o)) if (value.isNamed()) libs.add(value.asOWLNamedIndividual());
if (ind instanceof OWLIndividual) { for (OWLIndividual value : ((OWLIndividual) ind).getObjectPropertyValues(hasOntology, o)) if (value.isNamed()) ironts.add(value.asOWLNamedIndividual());
if (ind instanceof OWLIndividual) { for (OWLIndividual value : ((OWLIndividual) ind).getObjectPropertyValues(hasOntology, o)) if (value.isNamed()) ironts.add(value.asOWLNamedIndividual());