org.trippi
Class TriplePattern

java.lang.Object
  extended by org.trippi.TriplePattern

public class TriplePattern
extends java.lang.Object

A pattern that can be used to derive a Triple from a Map of Node objects.


Constructor Summary
TriplePattern(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
           
 
Method Summary
 java.lang.Object getObject()
          Get the object of the pattern.
 java.lang.Object getPredicate()
          Get the predicate of the pattern.
 java.lang.Object getSubject()
          Get the subject of the pattern.
static void main(java.lang.String[] args)
           
 org.jrdf.graph.Triple match(java.util.Map tuple)
          Get a Triple that matches this pattern using the provided tuple.
static TriplePattern[] parse(java.lang.String patterns)
           
static java.util.List parse(java.lang.String triples, org.jrdf.graph.GraphElementFactory factory)
          Parse and return a Set of Triples, treating variable bindings as anonymous nodes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TriplePattern

public TriplePattern(java.lang.Object subject,
                     java.lang.Object predicate,
                     java.lang.Object object)
              throws TrippiException
Throws:
TrippiException
Method Detail

parse

public static TriplePattern[] parse(java.lang.String patterns)
                             throws TrippiException
Throws:
TrippiException

parse

public static java.util.List parse(java.lang.String triples,
                                   org.jrdf.graph.GraphElementFactory factory)
                            throws TrippiException
Parse and return a Set of Triples, treating variable bindings as anonymous nodes.

Throws:
TrippiException

getSubject

public java.lang.Object getSubject()
Get the subject of the pattern. This will either be a String (a binding name) or a JRDF SubjectNode.

See Also:
SubjectNode

getPredicate

public java.lang.Object getPredicate()
Get the predicate of the pattern. This will either be a String (a binding name) or a JRDF PredicateNode.

See Also:
PredicateNode

getObject

public java.lang.Object getObject()
Get the object of the pattern. This will either be a String (a binding name) or a JRDF ObjectNode.

See Also:
ObjectNode

match

public org.jrdf.graph.Triple match(java.util.Map tuple)
                            throws TrippiException
Get a Triple that matches this pattern using the provided tuple.

Returns:
Triple if a Triple can be constructed, or null if any of the bound variables in the map are null or wouldn't match the required type for the triple.
Throws:
TrippiException - if the Map does not contain a key that matches a binding name in this pattern.

toString

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

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception