Class SSE

java.lang.Object
org.apache.jena.sparql.sse.SSE

public class SSE extends Object
SPARQL S-Expressions is a unstandardized format for SPARQL-related and now RDF-related objects. This includes use for writing down the SPARQL algebra in Apache Jena ARQ.

It has regular syntax, inspired by schema (lisp), making it easy to create and maintain builders and writers and to compose structures.

"()" and "[]" are interchangeable and used for visual effect. Expressions are parsed and printed in prefix notation e.g. (+ 1 ?x).

RDF-star quoted triples are This mean "item.getNode"

The operations are grouped into:

  • parseTYPE – parse a string to object of a specific kind.
  • readTYPE – Read a file and produce an object of a specific kind.
  • write – Write to a stream, default System.out
  • str – Create human readable strings.

parse(...), which produces a Item, is direct access to the syntax parser. Builders take parser Item and create the in-memory objects (package org.apache.jena.sparql.sse.builders) and writers output in-memory objects to an IndentedWriter (package org.apache.jena.sparql.sse.writers.

SSE should not be considered part of the public, stable Jena APIs.

If you don't like lots of "()" and indentation, look away now.

Efficiency at scale is not a primary design goal, though the core parser is streaming and would scale.

  • Method Details

    • getPrefixMapRead

      public static PrefixMapping getPrefixMapRead()
    • setPrefixMapRead

      public static void setPrefixMapRead(PrefixMapping pmap)
    • getPrefixMapString

      public static PrefixMapping getPrefixMapString()
    • setPrefixMapString

      public static void setPrefixMapString(PrefixMapping pmap)
    • getPrefixMapWrite

      public static PrefixMapping getPrefixMapWrite()
    • setPrefixMapWrite

      public static void setPrefixMapWrite(PrefixMapping pmap)
    • parseNode

      public static Node parseNode(String str)
      Parse a string to obtain a Node (see NodeFactory.parse()
    • parseNode

      public static Node parseNode(String str, PrefixMapping pmap)
      Parse a string to obtain a Node
    • parseQuad

      public static Quad parseQuad(String s)
      Parse a string to obtain a Quad
    • parseQuad

      public static Quad parseQuad(String s, PrefixMapping pmap)
      Parse a string to obtain a Quad
    • parseTriple

      public static Triple parseTriple(String str)
      Parse a string to obtain a Triple
    • parseTriple

      public static Triple parseTriple(String str, PrefixMapping pmap)
      Parse a string to obtain a Triple
    • parsePath

      public static Path parsePath(String str)
      Parse a string to obtain a path
    • parsePath

      public static Path parsePath(String str, PrefixMapping pmap)
      Parse a string to obtain a path
    • parseExpr

      public static Expr parseExpr(String s)
      Parse a string to obtain a SPARQL expression
    • parseExpr

      public static Expr parseExpr(String s, PrefixMapping pmap)
      Parse a string to obtain a SPARQL expression
    • parseExprList

      public static ExprList parseExprList(String s)
      Parse a string to obtain a list of SPARQL expressions
    • parseExprList

      public static ExprList parseExprList(String s, PrefixMapping pmap)
      Parse a string to obtain a list of SPARQL expressions
    • parseGraph

      public static Graph parseGraph(String string)
      Parse a string, and obtain a graph
    • parseGraph

      public static Graph parseGraph(String string, PrefixMapping pmap)
      Parse a string, and obtain a graph
    • readGraph

      public static Graph readGraph(String filename)
      Read in a file, parse, and obtain a graph
    • readGraph

      public static Graph readGraph(String filename, PrefixMapping pmap)
      Read in a file, parse, and obtain a graph
    • readGraph

      public static void readGraph(Graph graph, String filename)
      Read in a file, parse, and obtain a graph
    • readGraph

      public static void readGraph(Graph graph, String filename, PrefixMapping pmap)
      Read in a file, parse, and obtain a graph
    • parseDatasetGraph

      public static DatasetGraph parseDatasetGraph(String string)
      Parse a string, and obtain a DatasetGraph
    • parseDatasetGraph

      public static DatasetGraph parseDatasetGraph(String string, PrefixMapping pmap)
      Parse a string, and obtain a graph
    • readDatasetGraph

      public static DatasetGraph readDatasetGraph(String filename)
      Read in a file, parse, and obtain a graph
    • readDatasetGraph

      public static DatasetGraph readDatasetGraph(String filename, PrefixMapping pmap)
      Read in a file, parse, and obtain a DatasetGraph
    • readDatasetGraph

      public static void readDatasetGraph(DatasetGraph dsg, String filename)
      Read in a file, parse, load a DatasetGraph
    • readDatasetGraph

      public static void readDatasetGraph(DatasetGraph dsg, String filename, PrefixMapping pmap)
      Read in a file, parse, load a DatasetGraph
    • parseBinding

      public static Binding parseBinding(String string)
      Build a Binding
    • parseRowSet

      public static RowSet parseRowSet(String string)
      Build a RowSet
    • parseResultSet

      @Deprecated public static ResultSet parseResultSet(String string)
      Build a ResultSet
    • readOp

      public static Op readOp(String filename)
      Read in a file, parse, and obtain a SPARQL algebra op
    • parseOp

      public static Op parseOp(String s)
      Parse a string and obtain a SPARQL algebra op
    • parseOp

      public static Op parseOp(String s, PrefixMapping pmap)
      Parse a string and obtain a SPARQL algebra op, given a prefix mapping
    • readBGP

      public static BasicPattern readBGP(String filename)
      Read in a file, parse, and obtain a SPARQL algebra basic graph pattern
    • parseBGP

      public static BasicPattern parseBGP(String s)
      Parse a string and obtain a SPARQL algebra basic graph pattern
    • parseBGP

      public static BasicPattern parseBGP(String s, PrefixMapping pmap)
      Parse a string and obtain a SPARQL algebra basic graph pattern, given a prefix mapping
    • readTable

      public static Table readTable(String filename)
      Read a file and obtain a SPARQL algebra table
    • readTable

      public static Table readTable(String filename, PrefixMapping pmap)
      Read a file and obtain a SPARQL algebra table
    • parseTable

      public static Table parseTable(String s)
      Parse a string and obtain a SPARQL algebra table
    • parseTable

      public static Table parseTable(String s, PrefixMapping pmap)
      Parse a string and obtain a SPARQL algebra table
    • readFile

      public static Item readFile(String filename)
      Read a file and obtain an SSE item expression
    • readFile

      public static Item readFile(String filename, PrefixMapping pmap)
      Read a file and obtain an SSE item expression
    • parseRaw

      public static Item parseRaw(String str)
      Parse a string and obtain an SSE item expression (no additional prefix mappings)
    • parse

      public static Item parse(String str)
      Parse a string and obtain an SSE item expression
    • parse

      public static Item parse(String str, PrefixMapping pmap)
      Parse a string and obtain an SSE item expression
    • parse

      public static Item parse(InputStream in)
      Parse from an input stream and obtain an SSE item expression
    • parse

      public static Item parse(InputStream in, PrefixMapping pmap)
      Parse from an input stream and obtain an SSE item expression
    • setUseResolver

      public static void setUseResolver(boolean flag)
    • parseItem

      public static Item parseItem(String str)
    • parseItem

      public static Item parseItem(String str, PrefixMapping pmap)
    • parse

      public static Item parse(Reader reader)
    • parse

      public static Item parse(Reader reader, PrefixMapping pmap)
      The parser process. This includes lifting compound nodes and converting symbol constants. The reverse is in BuilderExpr node (direct to output) and ItemLift.reverse
    • str

      public static String str(Node node)
    • str

      public static String str(Node node, PrefixMapping pmap)
    • str

      public static String str(Triple triple)
    • str

      public static String str(Triple triple, PrefixMapping pmap)
    • strPlain

      public static String strPlain(Triple triple)
      Plain - with (), not (triple ...)
    • strPlain

      public static String strPlain(Triple triple, PrefixMapping pmap)
      Plain - with (), not (triple ...)
    • str

      public static String str(Quad quad)
    • str

      public static String str(Quad quad, PrefixMapping pmap)
    • strPlain

      public static String strPlain(Quad quad)
      Plain - with (), not (quad ...)
    • strPlain

      public static String strPlain(Quad quad, PrefixMapping pmap)
      Plain - with (), not (quad ...)
    • str

      public static String str(Graph graph)
    • str

      public static String str(Graph graph, PrefixMapping pmap)
    • str

      public static String str(DatasetGraph dsg)
    • str

      public static String str(DatasetGraph dsg, PrefixMapping pmap)
    • str

      public static String str(Expr expr)
    • str

      public static String str(Expr expr, PrefixMapping pmap)
    • str

      public static String str(BasicPattern bgp)
    • str

      public static String str(BasicPattern bgp, PrefixMapping pmap)
    • str

      public static String str(Op op)
    • str

      public static String str(Op op, PrefixMapping pmap)
    • write

      public static void write(Op op)
    • write

      public static void write(OutputStream out, Op op)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Op op)
    • write

      public static void write(Graph graph)
    • write

      public static void write(OutputStream out, Graph graph)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Graph graph)
    • write

      public static void write(Model model)
    • write

      public static void write(OutputStream out, Model model)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Model model)
    • write

      public static void write(DatasetGraph dataset)
    • write

      public static void write(OutputStream out, DatasetGraph dataset)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, DatasetGraph dataset)
    • write

      public static void write(Dataset dataset)
    • write

      public static void write(OutputStream out, Dataset dataset)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Dataset dataset)
    • write

      public static void write(BasicPattern pattern)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, BasicPattern pattern)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, BasicPattern pattern, PrefixMapping pMap)
    • write

      public static void write(Triple triple)
    • write

      public static void write(OutputStream out, Triple triple)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Triple triple)
    • write

      public static void write(Quad quad)
    • write

      public static void write(OutputStream out, Quad quad)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Quad quad)
    • write

      public static void write(Node node)
    • write

      public static void write(OutputStream out, Node node)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, Node node)
    • sCxt

      public static SerializationContext sCxt(Graph graph)
      Return a SerializationContext appropriate for the graph
    • sCxt

      public static SerializationContext sCxt(PrefixMapping pmap)
      Return a SerializationContext appropriate for the prefix mapping