de.fuberlin.wiwiss.d2rq.algebra
Class TripleRelation

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.NodeRelation
      extended by de.fuberlin.wiwiss.d2rq.algebra.TripleRelation

public class TripleRelation
extends NodeRelation

A collection of virtual triples obtained by applying a Relation to a database, and applying NodeMakers for subject, predicate and object to each result row. This is implemented as a stateless wrapper around a NodeRelation.

Author:
Chris Bizer chris@bizer.de, Richard Cyganiak (richard@cyganiak.de)

Field Summary
static Var OBJECT
           
static Var PREDICATE
           
static Var SUBJECT
           
 
Fields inherited from class de.fuberlin.wiwiss.d2rq.algebra.NodeRelation
TRUE
 
Constructor Summary
TripleRelation(Relation baseRelation, NodeMaker subjectMaker, NodeMaker predicateMaker, NodeMaker objectMaker)
           
 
Method Summary
 TripleRelation limit(int limit)
           
 TripleRelation orderBy(Var variable, boolean ascending)
           
 TripleRelation selectTriple(Triple t)
           
 TripleRelation selectWithVariables(Triple t)
          Creates a NodeRelation by applying a triple pattern to the TripleRelation.
 
Methods inherited from class de.fuberlin.wiwiss.d2rq.algebra.NodeRelation
baseRelation, empty, extendWith, nodeMaker, renameSingleRelation, select, toString, variables, withPrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUBJECT

public static final Var SUBJECT

PREDICATE

public static final Var PREDICATE

OBJECT

public static final Var OBJECT
Constructor Detail

TripleRelation

public TripleRelation(Relation baseRelation,
                      NodeMaker subjectMaker,
                      NodeMaker predicateMaker,
                      NodeMaker objectMaker)
Method Detail

orderBy

public TripleRelation orderBy(Var variable,
                              boolean ascending)
Overrides:
orderBy in class NodeRelation

limit

public TripleRelation limit(int limit)
Overrides:
limit in class NodeRelation

selectTriple

public TripleRelation selectTriple(Triple t)

selectWithVariables

public TripleRelation selectWithVariables(Triple t)
Creates a NodeRelation by applying a triple pattern to the TripleRelation. If the triple contains variables, then the variables will be bound to the corresponding values in the resulting NodeRelation. Node.ANY will be converted to a variable "subject", "predicate", "object" depending on its position in the triple pattern. For example, selecting (?x :name ?name) would produce a NodeRelation with ?x bound to the subjects and ?name bound to the objects of this TripleRelation. TODO This is never called at the moment. Why!?

Parameters:
t - A triple pattern involving variables
Returns:
A NodeRelation over the variables occurring in the triple pattern