/** * @param prop * @return */ protected URI getPropertyAsURI(final OWLDataProperty prop) { final OWLDataValue dv = individual.getProperty(prop); if (dv != null) { final Object value = dv.getValue(); if (value instanceof URI) return (URI) value; try { return new URI(value.toString().trim()); } catch (NullPointerException e) { /* fall through, we can not recover anyway */ } catch (URISyntaxException e) { /* fall through, we can not recover anyway */ } } return null; }
/** * This method can be used if it is known that the value of the given property syntactically * represents a URL. * * @return The value of the property converted to an URL. Returns <code>null</code> if there is no * statement containing this individual and the property, or the value is a malformed URL. */ protected URL getPropertyAsURL(final OWLDataProperty prop) { final OWLDataValue dv = individual.getProperty(prop); if (dv != null) { final Object value = dv.getValue(); try { if (value instanceof URI) return ((URI) value).toURL(); return new URL(value.toString().trim()); } catch (NullPointerException e) { /* fall through, we can not recover anyway */ } catch (IllegalArgumentException e) { /* fall through, we can not recover anyway */ } catch (MalformedURLException ignore) { /* fall through, we can not recover anyway */ } } return null; }
/* @see org.mindswap.owl.OWLIndividual#getProperty(org.mindswap.owl.OWLObjectProperty) */ public OWLIndividual getProperty(final OWLObjectProperty prop) { return individual.getProperty(prop); }
/* @see org.mindswap.owl.OWLIndividual#getProperty(org.mindswap.owl.OWLDataProperty, java.lang.String) */ public OWLDataValue getProperty(final OWLDataProperty prop, final String lang) { return individual.getProperty(prop, lang); }
/* @see org.mindswap.owl.OWLIndividual#getProperty(org.mindswap.owl.OWLDataProperty) */ public OWLDataValue getProperty(final OWLDataProperty prop) { return individual.getProperty(prop); }
/** * @param prop * @param lang * @return */ protected String getPropertyAsString(final OWLDataProperty prop, final String lang) { final OWLDataValue value = individual.getProperty(prop, lang); return (value == null) ? null : value.toString(); }
/** * @param <T> * @param prop * @param result * @return */ protected <T extends OWLDataValue> T getPropertyAs( final OWLDataProperty prop, final Class<T> result) { final OWLDataValue value = individual.getProperty(prop); return (value == null) ? null : value.castTo(result); }
/** * @param <T> * @param prop * @param result * @return */ protected <T extends OWLEntity> T getPropertyAs( final OWLObjectProperty prop, final Class<T> result) { final OWLIndividual value = individual.getProperty(prop); return (value == null) ? null : value.castTo(result); }