de.fuberlin.wiwiss.ng4j
Class Quad

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.Quad

public class Quad
extends Object

A Triple in a NamedGraph, consisting of four Jena Nodes: graphName, subject, predicate, and object. Any of the four fields may be a wildcard (Node.ANY). In this case, the Quad represents a quad pattern and not a specific quad.

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

Constructor Summary
Quad(Node graphName, Node subject, Node predicate, Node object)
          Creates a Quad from four Nodes.
Quad(Node graphName, Triple triple)
          Creates a Quad a triple and a graph name.
 
Method Summary
 boolean equals(Object o)
          Quads are equal iff both have four equal components.
 Node getGraphName()
           
 Node getObject()
           
 Node getPredicate()
           
 Node getSubject()
           
 Triple getTriple()
           
 boolean graphNameMatches(Node gn)
           
 int hashCode()
          The hash code of a quad is calculated in a way similar to Triple.
 boolean isConcrete()
           
 boolean matches(Node gn, Node s, Node p, Node o)
           
 boolean matches(Node gn, Triple t)
           
 boolean matches(Quad other)
           
 boolean objectMatches(Node o)
           
 boolean predicateMatches(Node p)
           
 boolean subjectMatches(Node s)
           
 String toString()
          Return a human-readable (sort of) string "graphname { s p o .
 String toString(PrefixMapping prefixMapping)
          Return a human-readable (sort of) string "graphname { s p o .
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quad

public Quad(Node graphName,
            Node subject,
            Node predicate,
            Node object)
Creates a Quad from four Nodes. null arguments are not allowed. Node.ANY can be used to create a quad pattern that matches any node at that position.


Quad

public Quad(Node graphName,
            Triple triple)
Creates a Quad a triple and a graph name. null arguments are not allowed. Node.ANY can be used to create a quad pattern that matches any graph name.

Method Detail

toString

public String toString()
Return a human-readable (sort of) string "graphname { s p o . }" describing the quad.

Overrides:
toString in class Object
Returns:
human-readable representation of this quad

toString

public String toString(PrefixMapping prefixMapping)
Return a human-readable (sort of) string "graphname { s p o . }" describing the quad.

Parameters:
prefixMapping - a prefix mapping for making URIs shorter
Returns:
human-readable representation of this quad

getGraphName

public Node getGraphName()

getSubject

public Node getSubject()

getPredicate

public Node getPredicate()

getObject

public Node getObject()

getTriple

public Triple getTriple()

isConcrete

public boolean isConcrete()
Returns:
true if this is a single quad; false if it is a quad pattern

equals

public boolean equals(Object o)
Quads are equal iff both have four equal components.

Overrides:
equals in class Object

matches

public boolean matches(Quad other)

matches

public boolean matches(Node gn,
                       Triple t)

matches

public boolean matches(Node gn,
                       Node s,
                       Node p,
                       Node o)

graphNameMatches

public boolean graphNameMatches(Node gn)

subjectMatches

public boolean subjectMatches(Node s)

predicateMatches

public boolean predicateMatches(Node p)

objectMatches

public boolean objectMatches(Node o)

hashCode

public int hashCode()
The hash code of a quad is calculated in a way similar to Triple.

Overrides:
hashCode in class Object