org.openanzo.server.repository.querybuilder
Class PropertyGrounding

java.lang.Object
  extended by org.openanzo.server.repository.querybuilder.PropertyGrounding
Direct Known Subclasses:
ConditionalGrounding

public class PropertyGrounding
extends java.lang.Object

Provides RDF objects (triple matches) to a query builder for a single predicate. Implementations declare getNode(ResultSet) to return the correct object for this triple match.

Author:
Joe Betz

Constructor Summary
PropertyGrounding(org.openrdf.model.URI predicate, Column column, ObjectGrounding literalGrounding)
          Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding
PropertyGrounding(org.openrdf.model.URI predicate, Column column, ObjectGrounding literalGrounding, java.util.Collection<Constraint> constraints)
          Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding
PropertyGrounding(org.openrdf.model.URI predicate, Column column, ObjectGrounding literalGrounding, Constraint constraint)
          Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding
PropertyGrounding(org.openrdf.model.URI predicate, org.openrdf.model.Value object)
          Create new PropertyGrounding for the given Predicate and Object value
 
Method Summary
 java.lang.Object constrainObject(org.openrdf.model.Value object, CompositeNodeLayout nodeLayout)
          Constrains the objects this element will match to the one specified and returns SQL representation of query if this grounding matches.
 boolean constrainPredicate(org.openrdf.model.URI predicate)
          Determine if this grounding's predicate matches the provided predicate
 java.util.Collection<Constraint> getConstraints()
          Gets a list of constraints that must be set in an SQL 'where' clause to get the correct triple match values for this object.
 java.lang.Long getId(CompositeNodeLayout nodeLayout)
          Get the ID of this predicate's value in the nodelayout
 java.util.List<Column> getSelections()
          Gets a list of columns that must be set in an SQL 'select' caluse to get the correct triple match values for this object.
 org.openrdf.model.URI getUri()
          Get URI for predicate
 IRdbTerm getValue(CompositeNodeLayout nodeLayout)
          Get the value for this predicate
 java.lang.String toSqlString(org.openrdf.model.Value object, CompositeNodeLayout nodeLayout)
          Converts a RDF object to a string that matches values in the SQL store equal to this object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyGrounding

public PropertyGrounding(org.openrdf.model.URI predicate,
                         org.openrdf.model.Value object)
Create new PropertyGrounding for the given Predicate and Object value

Parameters:
predicate - Predicate value of materialized triple
object - Object value of materialized triple

PropertyGrounding

public PropertyGrounding(org.openrdf.model.URI predicate,
                         Column column,
                         ObjectGrounding literalGrounding)
Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding

Parameters:
predicate - Predicate value of materialized triple
column - Column that contains object value for the materialized triple
literalGrounding - Grounding that contains object value that must match

PropertyGrounding

public PropertyGrounding(org.openrdf.model.URI predicate,
                         Column column,
                         ObjectGrounding literalGrounding,
                         Constraint constraint)
Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding

Parameters:
predicate - Predicate value of materialized triple
column - Column that contains object value for the materialized triple
literalGrounding - Grounding that contains object value that must match
constraint - Constaint that this grounding has to match

PropertyGrounding

public PropertyGrounding(org.openrdf.model.URI predicate,
                         Column column,
                         ObjectGrounding literalGrounding,
                         java.util.Collection<Constraint> constraints)
Create a new PropertyGrounding for the given Predicate and a column that matches a literal grounding

Parameters:
predicate - Predicate value of materialized triple
column - Column that contains object value for the materialized triple
literalGrounding - Grounding that contains object value that must match
constraints - Set of constaints that this grounding has to match
Method Detail

getUri

public org.openrdf.model.URI getUri()
Get URI for predicate

Returns:
URI for predicate

getId

public java.lang.Long getId(CompositeNodeLayout nodeLayout)
Get the ID of this predicate's value in the nodelayout

Parameters:
nodeLayout - CompositeNodeLayout to retrieve URIs and Node values
Returns:
the ID of this predicates value in the nodelayout

getValue

public IRdbTerm getValue(CompositeNodeLayout nodeLayout)
Get the value for this predicate

Parameters:
nodeLayout - CompositeNodeLayout to retrieve URIs and Node values
Returns:
the value for this predicate

constrainObject

public java.lang.Object constrainObject(org.openrdf.model.Value object,
                                        CompositeNodeLayout nodeLayout)
Constrains the objects this element will match to the one specified and returns SQL representation of query if this grounding matches.

Parameters:
object - Object to constrain this element
nodeLayout - INodeLayout that is used to fetch and store node values
Returns:
SQL query representation that constrains this object

constrainPredicate

public boolean constrainPredicate(org.openrdf.model.URI predicate)
Determine if this grounding's predicate matches the provided predicate

Parameters:
predicate - Predicate value to match against this grounding's predicate
Returns:
true if this grounding's predicate matches the provided predicate

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getConstraints

public java.util.Collection<Constraint> getConstraints()
Gets a list of constraints that must be set in an SQL 'where' clause to get the correct triple match values for this object.

Returns:
set of constraints for this grounding

getSelections

public java.util.List<Column> getSelections()
Gets a list of columns that must be set in an SQL 'select' caluse to get the correct triple match values for this object.

Returns:
list of columns for this grounding

toSqlString

public java.lang.String toSqlString(org.openrdf.model.Value object,
                                    CompositeNodeLayout nodeLayout)
Converts a RDF object to a string that matches values in the SQL store equal to this object.

Parameters:
object - Object to convert to string
nodeLayout - INodeLayout that is used to fetch and store URI and Node values
Returns:
a string that matches values in the SQL store equal to this object.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.