/** * Assuming that the range of values of the given data property can be parsed to URIs (e.g. typed * to <tt>xsd:anyURI</tt>), this method gets all values of the property in the backing KB and * tries to parse them into a URI. If a value can not be parsed it will be silently ignored. * * @param prop The data property whose range is expected to be <tt>xsd:anyURI</tt>. * @return The list of all URIs. */ protected List<URI> getPropertiesAsURI(final OWLDataProperty prop) { List<OWLDataValue> tmp = individual.getProperties(prop); List<URI> uris = new ArrayList<URI>(tmp.size()); for (OWLDataValue dataValue : tmp) { final Object value = dataValue.getValue(); if (value instanceof URI) uris.add((URI) value); try { uris.add(new URI(value.toString())); } catch (URISyntaxException ignore) { // we can not recover anyway; we could log something, which would be additional work } } return uris; }
/* @see org.mindswap.owl.OWLIndividual#getProperties() */ public Map<OWLProperty, List<OWLValue>> getProperties() { return individual.getProperties(); }
/* @see org.mindswap.owl.OWLIndividual#getProperties(org.mindswap.owl.OWLObjectProperty) */ public OWLIndividualList<?> getProperties(final OWLObjectProperty prop) { return individual.getProperties(prop); }
/* @see org.mindswap.owl.OWLIndividual#getProperties(org.mindswap.owl.OWLDataProperty) */ public List<OWLDataValue> getProperties(final OWLDataProperty prop) { return individual.getProperties(prop); }
/** * @param <T> * @param prop * @param result * @return */ protected <T extends OWLIndividual> OWLIndividualList<T> getPropertiesAs( final OWLObjectProperty prop, final Class<T> result) { return OWLFactory.castList(individual.getProperties(prop), result); }