Class TripleTermUtil
java.lang.Object
org.eclipse.rdf4j.rio.helpers.TripleTermUtil
Utility methods for RDF 1.2 triples.
- Author:
- Pavel Mihaylov
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIRI prefix for RDF 1.2 triples encoded as IRIs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Value>
TfromRDFEncodedValue(T encodedValue) Converts the supplied value from an RDF-compatible representation to an RDF 1.2 value.static <T extends Value>
TfromRDFEncodedValue(T encodedValue, ValueFactory valueFactory) Converts the supplied value from an RDF-compatible representation to an RDF 1.2 value.static booleanisEncodedTriple(Value value) Checks if the suppliedValuerepresents an RDF 1.2 triple encoded as an IRI.static <T extends Value>
TtoRDFEncodedValue(T value) Converts the supplied value from RDF 1.2 to an RDF-compatible representation.
-
Field Details
-
TRIPLE_PREFIX
-
-
Constructor Details
-
TripleTermUtil
public TripleTermUtil()
-
-
Method Details
-
toRDFEncodedValue
Converts the supplied value from RDF 1.2 to an RDF-compatible representation.RDF 1.2 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 1.2 values are valid in RDF as well and remain unchanged.
- Type Parameters:
T-- Parameters:
value- a RDF 1.2Valueto encode.- Returns:
- the RDF-compatible encoded value, if a
TripleTermwas supplied, or the supplied value otherwise.
-
fromRDFEncodedValue
Converts the supplied value from an RDF-compatible representation to an RDF 1.2 value.- Type Parameters:
T-- Parameters:
encodedValue- an RDFValueto convert to RDF 1.2.- Returns:
- the decoded RDF 1.2 tripleTerm, if a
TripleTermencoded asIRIwas supplied, or the supplied value otherwise. - Throws:
IllegalArgumentException- if the supplied value looked like an RDF 1.2 tripleTerm encoded as an IRI but it could not be decoded successfully.
-
fromRDFEncodedValue
Converts the supplied value from an RDF-compatible representation to an RDF 1.2 value.- Type Parameters:
T-- Parameters:
encodedValue- an RDFValueto convert to RDF 1.2.valueFactory- theValueFactoryto use for parsing the triple.- Returns:
- the decoded RDF 1.2 triple, if a
encoded as
invalid reference
TripleIRIwas supplied, or the supplied value otherwise. - Throws:
IllegalArgumentException- if the supplied value looked like an RDF 1.2 triple encoded as an IRI but it could not be decoded successfully.
-
isEncodedTriple
-