Class SSE


  • public class SSE
    extends java.lang.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).

    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 Detail

      • 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​(java.lang.String str)
        Parse a string to obtain a Node (see NodeFactory.parse()
      • parseNode

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

        public static Quad parseQuad​(java.lang.String s)
        Parse a string to obtain a Quad
      • parseQuad

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

        public static Triple parseTriple​(java.lang.String str)
        Parse a string to obtain a Triple
      • parseTriple

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

        public static Path parsePath​(java.lang.String str)
        Parse a string to obtain a path
      • parsePath

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

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

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

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

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

        public static Graph parseGraph​(java.lang.String string)
        Parse a string, and obtain a graph
      • parseGraph

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

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

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

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

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

        public static DatasetGraph parseDatasetGraph​(java.lang.String string)
        Parse a string, and obtain a DatasetGraph
      • parseDatasetGraph

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

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

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

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

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

        public static Binding parseBinding​(java.lang.String string)
        Build a Binding
      • parseResultSet

        public static ResultSet parseResultSet​(java.lang.String string)
        Build a ResultSet
      • readOp

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public static Item parse​(java.io.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​(java.lang.String str)
      • parseItem

        public static Item parseItem​(java.lang.String str,
                                     PrefixMapping pmap)
      • parse

        public static Item parse​(java.io.Reader reader)
      • str

        public static java.lang.String str​(Node node)
      • str

        public static java.lang.String str​(Triple triple)
      • strPlain

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

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

        public static java.lang.String str​(Quad quad)
      • strPlain

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

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

        public static java.lang.String str​(Graph graph)
      • str

        public static java.lang.String str​(DatasetGraph dsg)
      • str

        public static java.lang.String str​(Expr expr)
      • str

        public static java.lang.String str​(BasicPattern bgp)
      • str

        public static java.lang.String str​(Op op)
      • write

        public static void write​(Op op)
      • write

        public static void write​(java.io.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​(java.io.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​(java.io.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​(java.io.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​(java.io.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​(java.io.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​(java.io.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​(java.io.OutputStream out,
                                 Node node)
      • write

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