Class ValueMappings


  • public final class ValueMappings
    extends Object
    Common mappings from RDF terms to other values. For use in wrapping classes.
    Author:
    Samu Lang
    • Method Detail

      • literalAsString

        public static String literalAsString​(org.apache.jena.rdf.model.RDFNode node)
        Maps a literal node to its lexical form.
        Parameters:
        node - the node to map
        Returns:
        the lexical form of the node as a string
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.LiteralRequiredException - if the node is not a literal
      • iriAsUri

        public static URI iriAsUri​(org.apache.jena.rdf.model.RDFNode node)
        Maps a resource node to its IRI.
        Parameters:
        node - the node to convert
        Returns:
        the IRI of the node as a string
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.ResourceRequiredException - if the node is not a resource
      • iriAsString

        public static String iriAsString​(org.apache.jena.rdf.model.RDFNode node)
        Maps a resource node to its IRI.
        Parameters:
        node - the node to convert
        Returns:
        the IRI of the node as a string
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.ResourceRequiredException - if the node is not a resource
      • literalAsInstant

        public static Instant literalAsInstant​(org.apache.jena.rdf.model.RDFNode node)
        Maps a literal node to a point in time.
        Parameters:
        node - the node to map
        Returns:
        the point in time represented by the node's lexical form as an Instant
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.LiteralRequiredException - if the node is not a literal
        DateTimeParseException - if the node's lexical form cannot be parsed as an Instant
      • literalAsBoolean

        public static Boolean literalAsBoolean​(org.apache.jena.rdf.model.RDFNode node)
        Maps a literal node to a boolean.
        Parameters:
        node - the node to map
        Returns:
        the boolean represented by the node's lexical form as a Boolean
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.LiteralRequiredException - if the node is not a literal
      • literalAsIntegerOrNull

        public static Integer literalAsIntegerOrNull​(org.apache.jena.rdf.model.RDFNode node)
        Maps a literal node to an integer.
        Parameters:
        node - the node to map
        Returns:
        the integer represented by the node's lexical form or null if the form can not be parsed
        Throws:
        NullPointerException - if the node is null
        org.apache.jena.rdf.model.LiteralRequiredException - if the node is not a literal