Interface Relationlet

All Known Subinterfaces:
Pathlet, RelationletNested, RelationletSimple
All Known Implementing Classes:
PathletJoinerImpl, PathletSimple, RelationletBase, RelationletBaseWithMutableFixedVars, RelationletBinary, RelationletElementBase, RelationletElementImpl, RelationletForwarding, RelationletJoinerImpl, RelationletNestedImpl

public interface Relationlet
Relationlets ("relation snippets") represent nested expression of joins of relations (graph patterns). The concept is as follows: SPARQL graph patterns and SPARQL select queries intensionally describe a result set which can be seen akin to an SQL relation (table). In SQL it is possible to express joins between individual relations by assigning them aliases and using these aliases together with column names in join expressions, e.g:
SELECT * FROM departments AS a JOIN employees AS b ON (a.id = b.department_id)

 However, SPARQL does not provide such a mechanism for constructing JOINs between individual graph patterns.
 This class enables construction of such SQL-like join expression.

 The model of relationlets can be SQL-like join expression:
 relationlet1 AS alias1
   JOIN (relationlet2 AS alias2 JOIN relationlet3 AS alias3 ON (alias2.?y = alias3.?z)) AS alias4
   ON   (alias1.?s = alias4.?z)

 The method materialize() yields for such an expression a single graph pattern with all the
 book-keeping in place to find out which variable of which joining graph pattern was mapped to which variable
 in the materialized one.

 Relationlets provide control over variable renaming and exposition:

 
  • Joins in this context implies appropriate variable renaming
  • Variables can be pinned to prevent renaming them during materialization
  • Joining on two pinned non-equal variables results raises an exception
  • Specific variables in a graph pattern can be exposed under a global name (w.r.t. to this relationlet) so that the name can be used to refer to that variable
Relevant sub classes are: TODO The question is how Relation's distinguished vars translate to this class - is it exposedVars? - not really; exposedVars is a Set whereas distinguished vars is a list
Author:
raven
  • Method Details

    • getExposedVars

      Collection<org.apache.jena.sparql.core.Var> getExposedVars()
    • getVarsMentioned

      Set<org.apache.jena.sparql.core.Var> getVarsMentioned()
    • isPinned

      default boolean isPinned(org.apache.jena.sparql.core.Var var)
    • pinVar

      default Relationlet pinVar(org.apache.jena.sparql.core.Var var)
    • pinAllVars

      default Relationlet pinAllVars()
      Adds all variables currently returned by getVarsMentioned() to the set of fixed vars. Does not mark vars that become available in the future as fixed.
      Returns:
    • pinAllVars

      default Relationlet pinAllVars(Iterable<org.apache.jena.sparql.core.Var> vars)
    • getPinnedVars

      Set<org.apache.jena.sparql.core.Var> getPinnedVars()
    • setPinnedVar

      Relationlet setPinnedVar(org.apache.jena.sparql.core.Var var, boolean onOrOff)
    • materialize

      RelationletSimple materialize()
    • getNestedVarMap

      NestedVarMap getNestedVarMap()
    • resolve

      default org.apache.jena.sparql.core.Var resolve(VarRefStatic varRef)