예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /* @see org.mindswap.owl.OWLIndividual#getProperty(org.mindswap.owl.OWLObjectProperty) */
 public OWLIndividual getProperty(final OWLObjectProperty prop) {
   return individual.getProperty(prop);
 }
예제 #4
0
 /* @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);
 }
예제 #5
0
 /* @see org.mindswap.owl.OWLIndividual#getProperty(org.mindswap.owl.OWLDataProperty) */
 public OWLDataValue getProperty(final OWLDataProperty prop) {
   return individual.getProperty(prop);
 }
예제 #6
0
 /**
  * @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();
 }
예제 #7
0
 /**
  * @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);
 }
예제 #8
0
 /**
  * @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);
 }