Class ModelUtils

java.lang.Object
se.liu.ida.hefquin.jenaext.ModelUtils

public class ModelUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static org.apache.jena.rdf.model.Literal
    getSingleLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
     
    static org.apache.jena.rdf.model.Literal
    getSingleMandatoryLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource has a single value for the given property and this value is a literal.
    static org.apache.jena.rdf.model.RDFNode
    getSingleMandatoryProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Based on the assumption that the given resource has a single value for the given property, this function returns this.
    static String
    getSingleMandatoryProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource has a single value for the given property and this value is an xsd:string literal.
    static URI
    getSingleMandatoryProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource has a single value for the given property and this value is an xsd:anyURI literal.
    static org.apache.jena.rdf.model.Resource
    getSingleMandatoryResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource has a single value for the given property and this value is a resource (not a literal).
    static org.apache.jena.rdf.model.Literal
    getSingleOptionalLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource may have a single value for the given property and, if so, this value is a literal.
    static org.apache.jena.rdf.model.RDFNode
    getSingleOptionalProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Based on the assumption that the given resource may have a single value for the given property, this function returns either this value or null, depending on whether the resource has such a value.
    static String
    getSingleOptionalProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource may have a single value for the given property and, if so, this value is an xsd:string literal.
    static URI
    getSingleOptionalProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource may have a single value for the given property and, if so, this value is an xsd:anyURI literal.
    static org.apache.jena.rdf.model.Resource
    getSingleOptionalResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Assumes that the given resource may have a single value for the given property and, if so, this value is a resource (not a literal).
    protected static org.apache.jena.rdf.model.RDFNode
    getSingleProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
     
    protected static String
    getSingleProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
     
    protected static URI
    getSingleProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
     
    protected static org.apache.jena.rdf.model.Resource
    getSingleResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ModelUtils

      public ModelUtils()
  • Method Details

    • getSingleOptionalProperty

      public static org.apache.jena.rdf.model.RDFNode getSingleOptionalProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Based on the assumption that the given resource may have a single value for the given property, this function returns either this value or null, depending on whether the resource has such a value. If the resource has multiple values for the property, an IllegalArgumentException is thrown.
    • getSingleOptionalResourceProperty

      public static org.apache.jena.rdf.model.Resource getSingleOptionalResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource may have a single value for the given property and, if so, this value is a resource (not a literal). Based on this assumption, this function returns either the literal or null, depending on whether the resource has such a value. If the value is not a resource or the resource has multiple values for the property, an IllegalArgumentException is thrown.
    • getSingleOptionalLiteralProperty

      public static org.apache.jena.rdf.model.Literal getSingleOptionalLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource may have a single value for the given property and, if so, this value is a literal. Based on this assumption, this function returns either the literal or null, depending on whether the resource has such a value. If the value is not a literal or the resource has multiple values for the property, an IllegalArgumentException is thrown.
    • getSingleOptionalProperty_XSDString

      public static String getSingleOptionalProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource may have a single value for the given property and, if so, this value is an xsd:string literal. Based on this assumption, this function returns either the string of this literal or null, depending on whether the resource has such a value. If the value is not an xsd:string literal or the resource has multiple values for the property, an IllegalArgumentException is thrown.
    • getSingleOptionalProperty_XSDURI

      public static URI getSingleOptionalProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource may have a single value for the given property and, if so, this value is an xsd:anyURI literal. Based on this assumption, this function returns either the URI of this literal or null, depending on whether the resource has such a value. If the value is not an xsd:anyURI literal, the lexical form of the literal cannot be converted into a URI, or the resource has multiple values for the property, an IllegalArgumentException is thrown.
    • getSingleMandatoryProperty

      public static org.apache.jena.rdf.model.RDFNode getSingleMandatoryProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Based on the assumption that the given resource has a single value for the given property, this function returns this. An IllegalArgumentException is thrown if the resource does not have any value for the property or it has multiple values for the property.
    • getSingleMandatoryResourceProperty

      public static org.apache.jena.rdf.model.Resource getSingleMandatoryResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource has a single value for the given property and this value is a resource (not a literal). Based on this assumption, this function returns this literal. An IllegalArgumentException is thrown if the value is not a resource, the resource does not have any value for the property, or it has multiple values for the property.
    • getSingleMandatoryLiteralProperty

      public static org.apache.jena.rdf.model.Literal getSingleMandatoryLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource has a single value for the given property and this value is a literal. Based on this assumption, this function returns this literal. An IllegalArgumentException is thrown if the value is not a literal, the resource does not have any value for the property, or it has multiple values for the property.
    • getSingleMandatoryProperty_XSDString

      public static String getSingleMandatoryProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource has a single value for the given property and this value is an xsd:string literal. Based on this assumption, this function returns the string of this literal. An IllegalArgumentException is thrown if the value is not an xsd:string literal, the resource does not have any value for the property, or it has multiple values for the property.
    • getSingleMandatoryProperty_XSDURI

      public static URI getSingleMandatoryProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Assumes that the given resource has a single value for the given property and this value is an xsd:anyURI literal. Based on this assumption, this function returns the URI of this literal. An IllegalArgumentException is thrown if the value is not an xsd:anyURI literal, the lexical form of the literal cannot be converted into a URI, the resource does not have any value for the property, or it has multiple values for the property.
    • getSingleProperty

      protected static org.apache.jena.rdf.model.RDFNode getSingleProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
    • getSingleResourceProperty

      protected static org.apache.jena.rdf.model.Resource getSingleResourceProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
    • getSingleLiteralProperty

      protected static org.apache.jena.rdf.model.Literal getSingleLiteralProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
    • getSingleProperty_XSDString

      protected static String getSingleProperty_XSDString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)
    • getSingleProperty_XSDURI

      protected static URI getSingleProperty_XSDURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, boolean mandatory)