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 Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.shared.PrefixMapping
     
    static org.apache.jena.shared.PrefixMapping
     
    static org.apache.jena.shared.PrefixMapping
     
    static Item
    Parse from an input stream and obtain an SSE item expression
    static Item
    parse(InputStream in, org.apache.jena.shared.PrefixMapping pmap)
    Parse from an input stream and obtain an SSE item expression
    static Item
    parse(Reader reader)
     
    static Item
    parse(Reader reader, org.apache.jena.shared.PrefixMapping pmap)
    The parser process.
    static Item
    Parse a string and obtain an SSE item expression
    static Item
    parse(String str, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string and obtain an SSE item expression
    Parse a string and obtain a SPARQL algebra basic graph pattern
    parseBGP(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string and obtain a SPARQL algebra basic graph pattern, given a prefix mapping
    static Binding
    Build a Binding
    Parse a string, and obtain a DatasetGraph
    parseDatasetGraph(String string, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string, and obtain a graph
    static Expr
    Parse a string to obtain a SPARQL expression
    static Expr
    parseExpr(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a SPARQL expression
    static ExprList
    Parse a string to obtain a list of SPARQL expressions
    static ExprList
    parseExprList(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a list of SPARQL expressions
    static org.apache.jena.graph.Graph
    Parse a string, and obtain a graph
    static org.apache.jena.graph.Graph
    parseGraph(String string, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string, and obtain a graph
    static Item
     
    static Item
    parseItem(String str, org.apache.jena.shared.PrefixMapping pmap)
     
    static org.apache.jena.graph.Node
    Parse a string to obtain a Node (see NodeFactory.parse()
    static org.apache.jena.graph.Node
    parseNode(String str, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a Node
    static Op
    Parse a string and obtain a SPARQL algebra op
    static Op
    parseOp(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string and obtain a SPARQL algebra op, given a prefix mapping
    static Path
    Parse a string to obtain a path
    static Path
    parsePath(String str, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a path
    static Quad
    Parse a string to obtain a Quad
    static Quad
    parseQuad(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a Quad
    static Item
    Parse a string and obtain an SSE item expression (no additional prefix mappings)
    static RowSet
    Build a RowSet
    static Table
    Parse a string and obtain a SPARQL algebra table
    static Table
    parseTable(String s, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string and obtain a SPARQL algebra table
    static org.apache.jena.graph.Triple
    Parse a string to obtain a Triple
    static org.apache.jena.graph.Triple
    parseTriple(String str, org.apache.jena.shared.PrefixMapping pmap)
    Parse a string to obtain a Triple
    readBGP(String filename)
    Read in a file, parse, and obtain a SPARQL algebra basic graph pattern
    Read in a file, parse, and obtain a graph
    readDatasetGraph(String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read in a file, parse, and obtain a DatasetGraph
    static void
    Read in a file, parse, load a DatasetGraph
    static void
    readDatasetGraph(DatasetGraph dsg, String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read in a file, parse, load a DatasetGraph
    static Item
    readFile(String filename)
    Read a file and obtain an SSE item expression
    static Item
    readFile(String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read a file and obtain an SSE item expression
    static org.apache.jena.graph.Graph
    readGraph(String filename)
    Read in a file, parse, and obtain a graph
    static org.apache.jena.graph.Graph
    readGraph(String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read in a file, parse, and obtain a graph
    static void
    readGraph(org.apache.jena.graph.Graph graph, String filename)
    Read in a file, parse, and obtain a graph
    static void
    readGraph(org.apache.jena.graph.Graph graph, String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read in a file, parse, and obtain a graph
    static Op
    readOp(String filename)
    Read in a file, parse, and obtain a SPARQL algebra op
    static Table
    readTable(String filename)
    Read a file and obtain a SPARQL algebra table
    static Table
    readTable(String filename, org.apache.jena.shared.PrefixMapping pmap)
    Read a file and obtain a SPARQL algebra table
    sCxt(org.apache.jena.graph.Graph graph)
    Return a SerializationContext appropriate for the graph
    sCxt(org.apache.jena.shared.PrefixMapping pmap)
    Return a SerializationContext appropriate for the prefix mapping
    static void
    setPrefixMapRead(org.apache.jena.shared.PrefixMapping pmap)
     
    static void
    setPrefixMapString(org.apache.jena.shared.PrefixMapping pmap)
     
    static void
    setPrefixMapWrite(org.apache.jena.shared.PrefixMapping pmap)
     
    static void
    setUseResolver(boolean flag)
     
    static String
    str(org.apache.jena.graph.Graph graph)
     
    static String
    str(org.apache.jena.graph.Graph graph, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    str(org.apache.jena.graph.Node node)
     
    static String
    str(org.apache.jena.graph.Node node, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    str(org.apache.jena.graph.Triple triple)
     
    static String
    str(org.apache.jena.graph.Triple triple, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    str(Op op)
     
    static String
    str(Op op, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
     
    static String
    str(BasicPattern bgp, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
     
    static String
    str(DatasetGraph dsg, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    str(Quad quad)
     
    static String
    str(Quad quad, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    str(Expr expr)
     
    static String
    str(Expr expr, org.apache.jena.shared.PrefixMapping pmap)
     
    static String
    strPlain(org.apache.jena.graph.Triple triple)
    Plain - with (), not (triple ...)
    static String
    strPlain(org.apache.jena.graph.Triple triple, org.apache.jena.shared.PrefixMapping pmap)
    Plain - with (), not (triple ...)
    static String
    strPlain(Quad quad)
    Plain - with (), not (quad ...)
    static String
    strPlain(Quad quad, org.apache.jena.shared.PrefixMapping pmap)
    Plain - with (), not (quad ...)
    static void
    write(OutputStream out, org.apache.jena.graph.Graph graph)
     
    static void
    write(OutputStream out, org.apache.jena.graph.Node node)
     
    static void
    write(OutputStream out, org.apache.jena.graph.Triple triple)
     
    static void
    write(OutputStream out, Dataset dataset)
     
    static void
    write(OutputStream out, org.apache.jena.rdf.model.Model model)
     
    static void
    write(OutputStream out, Op op)
     
    static void
     
    static void
    write(OutputStream out, Quad quad)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.graph.Graph graph)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.graph.Node node)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.graph.Triple triple)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, Dataset dataset)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.rdf.model.Model model)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, Op op)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, BasicPattern pattern)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, BasicPattern pattern, org.apache.jena.shared.PrefixMapping pMap)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, DatasetGraph dataset)
     
    static void
    write(org.apache.jena.atlas.io.IndentedWriter out, Quad quad)
     
    static void
    write(org.apache.jena.graph.Graph graph)
     
    static void
    write(org.apache.jena.graph.Node node)
     
    static void
    write(org.apache.jena.graph.Triple triple)
     
    static void
    write(Dataset dataset)
     
    static void
    write(org.apache.jena.rdf.model.Model model)
     
    static void
    write(Op op)
     
    static void
     
    static void
     
    static void
    write(Quad quad)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getPrefixMapRead

      public static org.apache.jena.shared.PrefixMapping getPrefixMapRead()
    • setPrefixMapRead

      public static void setPrefixMapRead(org.apache.jena.shared.PrefixMapping pmap)
    • getPrefixMapString

      public static org.apache.jena.shared.PrefixMapping getPrefixMapString()
    • setPrefixMapString

      public static void setPrefixMapString(org.apache.jena.shared.PrefixMapping pmap)
    • getPrefixMapWrite

      public static org.apache.jena.shared.PrefixMapping getPrefixMapWrite()
    • setPrefixMapWrite

      public static void setPrefixMapWrite(org.apache.jena.shared.PrefixMapping pmap)
    • parseNode

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

      public static org.apache.jena.graph.Node parseNode(String str, org.apache.jena.shared.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, org.apache.jena.shared.PrefixMapping pmap)
      Parse a string to obtain a Quad
    • parseTriple

      public static org.apache.jena.graph.Triple parseTriple(String str)
      Parse a string to obtain a Triple
    • parseTriple

      public static org.apache.jena.graph.Triple parseTriple(String str, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.PrefixMapping pmap)
      Parse a string to obtain a list of SPARQL expressions
    • parseGraph

      public static org.apache.jena.graph.Graph parseGraph(String string)
      Parse a string, and obtain a graph
    • parseGraph

      public static org.apache.jena.graph.Graph parseGraph(String string, org.apache.jena.shared.PrefixMapping pmap)
      Parse a string, and obtain a graph
    • readGraph

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

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

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

      public static void readGraph(org.apache.jena.graph.Graph graph, String filename, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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
    • 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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.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, org.apache.jena.shared.PrefixMapping pmap)
    • parse

      public static Item parse(Reader reader)
    • parse

      public static Item parse(Reader reader, org.apache.jena.shared.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(org.apache.jena.graph.Node node)
    • str

      public static String str(org.apache.jena.graph.Node node, org.apache.jena.shared.PrefixMapping pmap)
    • str

      public static String str(org.apache.jena.graph.Triple triple)
    • str

      public static String str(org.apache.jena.graph.Triple triple, org.apache.jena.shared.PrefixMapping pmap)
    • strPlain

      public static String strPlain(org.apache.jena.graph.Triple triple)
      Plain - with (), not (triple ...)
    • strPlain

      public static String strPlain(org.apache.jena.graph.Triple triple, org.apache.jena.shared.PrefixMapping pmap)
      Plain - with (), not (triple ...)
    • str

      public static String str(Quad quad)
    • str

      public static String str(Quad quad, org.apache.jena.shared.PrefixMapping pmap)
    • strPlain

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

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

      public static String str(org.apache.jena.graph.Graph graph)
    • str

      public static String str(org.apache.jena.graph.Graph graph, org.apache.jena.shared.PrefixMapping pmap)
    • str

      public static String str(DatasetGraph dsg)
    • str

      public static String str(DatasetGraph dsg, org.apache.jena.shared.PrefixMapping pmap)
    • str

      public static String str(Expr expr)
    • str

      public static String str(Expr expr, org.apache.jena.shared.PrefixMapping pmap)
    • str

      public static String str(BasicPattern bgp)
    • str

      public static String str(BasicPattern bgp, org.apache.jena.shared.PrefixMapping pmap)
    • str

      public static String str(Op op)
    • str

      public static String str(Op op, org.apache.jena.shared.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(org.apache.jena.graph.Graph graph)
    • write

      public static void write(OutputStream out, org.apache.jena.graph.Graph graph)
    • write

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

      public static void write(org.apache.jena.rdf.model.Model model)
    • write

      public static void write(OutputStream out, org.apache.jena.rdf.model.Model model)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.rdf.model.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, org.apache.jena.shared.PrefixMapping pMap)
    • write

      public static void write(org.apache.jena.graph.Triple triple)
    • write

      public static void write(OutputStream out, org.apache.jena.graph.Triple triple)
    • write

      public static void write(org.apache.jena.atlas.io.IndentedWriter out, org.apache.jena.graph.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(org.apache.jena.graph.Node node)
    • write

      public static void write(OutputStream out, org.apache.jena.graph.Node node)
    • write

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

      public static SerializationContext sCxt(org.apache.jena.graph.Graph graph)
      Return a SerializationContext appropriate for the graph
    • sCxt

      public static SerializationContext sCxt(org.apache.jena.shared.PrefixMapping pmap)
      Return a SerializationContext appropriate for the prefix mapping