Class RDFStarUtil


public class RDFStarUtil extends Object
Utility methods for RDF-star triples.
Pavel Mihaylov
  • Field Details


      public static final String TRIPLE_PREFIX
      IRI prefix for RDF-star triples encoded as IRIs.
      See Also:
  • Constructor Details

    • RDFStarUtil

      public RDFStarUtil()
  • Method Details

    • toRDFEncodedValue

      public static <T extends Value> T toRDFEncodedValue(T value)
      Converts the supplied value from RDF-star to an RDF-compatible representation.

      RDF-star triples are encoded as IRIs that start with TRIPLE_PREFIX, followed by the base64 encoding of the N-Triples serialization of the triple.

      All other RDF-star values are valid in RDF as well and remain unchanged.

      Type Parameters:
      T -
      value - a RDF-star Value to encode.
      the RDF-compatible encoded value, if a Triple was supplied, or the supplied value otherwise.
    • fromRDFEncodedValue

      public static <T extends Value> T fromRDFEncodedValue(T encodedValue)
      Converts the supplied value from an RDF-compatible representation to an RDF-star value.

      See toRDFEncodedValue(Value).

      Type Parameters:
      T -
      encodedValue - an RDF Value to convert to RDF-star.
      the decoded RDF-star triple, if a Triple encoded as IRI was supplied, or the supplied value otherwise.
      IllegalArgumentException - if the supplied value looked like an RDF-star triple encoded as an IRI but it could not be decoded successfully.
    • isEncodedTriple

      public static boolean isEncodedTriple(Value value)
      Checks if the supplied Value represents an RDF-star triple encoded as an IRI.
      value - the value to check.
      True if the value is an RDF-star triple encoded as an IRI, false otherwise.