Class ThriftConvert

java.lang.Object
org.apache.jena.riot.thrift.ThriftConvert

public class ThriftConvert extends Object
Convert to and from Thrift wire objects. See StreamRDF2Thrift and Thrift2StreamRDF for ways to convert as streams (they recycle intermediate objects).

Many operations have available with a cache. The cache is used for creating URis from strings. It interns the node leading to significant savings of space, especially in the property position.

See Also:
  • Constructor Details

    • ThriftConvert

      public ThriftConvert()
  • Method Details

    • toThriftValue

      public static boolean toThriftValue(org.apache.jena.graph.Node node, RDF_Term term)
      Attempt to encode a node by value (integer, decimal, double) into an RDF_term.
      Parameters:
      node -
      term -
      Returns:
      true if the term was set, else false.
    • toThrift

      public static void toThrift(org.apache.jena.graph.Node node, RDF_Term term)
      Encode a Node into an RDF_Term, using values (integer, decimal, double) if possible.
    • toThrift

      public static void toThrift(org.apache.jena.graph.Node node, RDF_Term term, boolean allowValues)
      Encode a Node into an RDF_Term. Control whether to use values (integer, decimal, double) if possible.
    • toThrift

      public static void toThrift(org.apache.jena.graph.Node node, PrefixMap pmap, RDF_Term term, boolean allowValues)
      Encode a Node into an RDF_Term
    • convert

      public static org.apache.jena.graph.Node convert(RDF_Term term)
      Build a Node from an RDF_Term.
    • convert

      public static org.apache.jena.graph.Node convert(org.apache.jena.atlas.lib.Cache<String,org.apache.jena.graph.Node> uriCache, RDF_Term term)
      Build a Node from an RDF_Term.
    • convert

      public static org.apache.jena.graph.Node convert(RDF_Term term, PrefixMap pmap)
      Build a Node from an RDF_Term.
    • convert

      public static org.apache.jena.graph.Node convert(org.apache.jena.atlas.lib.Cache<String,org.apache.jena.graph.Node> uriCache, RDF_Term term, PrefixMap pmap)
      Build a Node from an RDF_Term using a prefix map which must agree with the map used to create the RDF_Term in the first place.
    • convert

      public static RDF_Term convert(org.apache.jena.graph.Node node, boolean allowValues)
    • convert

      public static RDF_Term convert(org.apache.jena.graph.Node node, PrefixMap pmap, boolean allowValues)
    • convert

      public static org.apache.jena.graph.Triple convert(RDF_Triple triple)
    • convert

      public static org.apache.jena.graph.Triple convert(RDF_Triple rt, PrefixMap pmap)
    • convert

      public static org.apache.jena.graph.Triple convert(org.apache.jena.atlas.lib.Cache<String,org.apache.jena.graph.Node> uriCache, RDF_Triple rt, PrefixMap pmap)
    • convert

      public static RDF_Triple convert(org.apache.jena.graph.Triple triple, boolean allowValues)
    • convert

      public static RDF_Triple convert(org.apache.jena.graph.Triple triple, PrefixMap pmap, boolean allowValues)
    • convert

      public static Quad convert(RDF_Quad quad)
    • convert

      public static Quad convert(RDF_Quad rq, PrefixMap pmap)
    • convert

      public static Quad convert(org.apache.jena.atlas.lib.Cache<String,org.apache.jena.graph.Node> uriCache, RDF_Quad rq, PrefixMap pmap)
    • convert

      public static RDF_Quad convert(Quad quad, boolean allowValues)
    • convert

      public static RDF_Quad convert(Quad quad, PrefixMap pmap, boolean allowValues)
    • termToBytes

      public static byte[] termToBytes(RDF_Term term)
      Serialize the RDF_Term into a byte array.

      Where possible, to is better to serialize into a stream, directly using term.write(TProtocol).

    • termFromBytes

      public static RDF_Term termFromBytes(byte[] bytes)
      Deserialize from a byte array into an RDF_Term.

      Where possible, to is better to deserialize from a stream, directly using term.read(TProtocol).

    • termFromBytes

      public static void termFromBytes(RDF_Term term, byte[] bytes)
      Deserialize from a byte array into an RDF_Term.

      Where possible, to is better to deserialize from a stream, directly using term.read(TProtocol).