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 methodmaterialize()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
RelationletSimplerepresents a single graph pattern and this type is also the result of materializationRelationletJoinerImplrepresents a join expression of graph patterns
- Author:
- raven
-
Method Summary
Modifier and TypeMethodDescriptionCollection<org.apache.jena.sparql.core.Var>Set<org.apache.jena.sparql.core.Var>Set<org.apache.jena.sparql.core.Var>default booleanisPinned(org.apache.jena.sparql.core.Var var) default RelationletAdds all variables currently returned by getVarsMentioned() to the set of fixed vars.default RelationletpinAllVars(Iterable<org.apache.jena.sparql.core.Var> vars) default RelationletpinVar(org.apache.jena.sparql.core.Var var) default org.apache.jena.sparql.core.Varresolve(VarRefStatic varRef) setPinnedVar(org.apache.jena.sparql.core.Var var, boolean onOrOff)
-
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
-
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
-
getPinnedVars
Set<org.apache.jena.sparql.core.Var> getPinnedVars() -
setPinnedVar
-
materialize
RelationletSimple materialize() -
getNestedVarMap
NestedVarMap getNestedVarMap() -
resolve
-