Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.graph
Class Triple  view Triple download Triple.java

java.lang.Object
  extended bycom.hp.hpl.jena.graph.Triple
All Implemented Interfaces:
TripleMatch

public class Triple
extends java.lang.Object
implements TripleMatch

Triples are the basis for RDF statements; they have a subject, predicate, and object field (all nodes) and express the notion that the relationship named by the predicate holds between the subject and the object.


Field Summary
static Triple ANY
           
protected static TripleCache cache
          The cache of already-created triples.
private  Node obj
           
private  Node pred
           
private  Node subj
           
 
Constructor Summary
Triple(Node s, Node p, Node o)
           
 
Method Summary
private static Node anyToNull(Node n)
           
 Triple asTriple()
          Answer a Triple capturing this match.
static Triple create(Node s, Node p, Node o)
          Factory method for creating triples, allows caching opportunities.
static Triple create(com.hp.hpl.jena.shared.PrefixMapping pm, java.lang.String fact)
          Utility factory as for create(String), but allowing the PrefixMapping to be specified explicitly.
static Triple create(java.lang.String fact)
          Utility factory method for creating a triple based on the content of an "S P O" string.
static Triple createMatch(Node s, Node p, Node o)
           
 boolean equals(java.lang.Object o)
          Answer true if o is a Triple with the same subject, predicate, and object as this triple.
 Node getMatchObject()
          If it is known that all triples selected by this match will have a common object, return that node, otherwise return null
 Node getMatchPredicate()
          If it is known that all triples selected by this match will have a common predicate, return that node, otherwise return null
 Node getMatchSubject()
          If it is known that all triples selected by this filter will have a common subject, return that node, otherwise return null
 Node getObject()
           
 Node getPredicate()
           
 Node getSubject()
           
 int hashCode()
          The hash-code of a triple is the hash-codes of its components munged together: see hashCode(S, P, O).
static int hashCode(Node s, Node p, Node o)
          Return the munged hashCodes of the specified nodes, an exclusive-or of the slightly-shifted component hashcodes; this means (almost) all of the bits count, and the order matters, so (S @P O) has a different hash from (O @P S), etc.
 boolean isConcrete()
           
private  boolean matchedBy(Node s, Node p, Node o)
           
 boolean matches(Node s, Node p, Node o)
           
 boolean matches(Triple other)
           
private static Node nullToAny(Node n)
           
 boolean objectMatches(Node o)
           
 boolean predicateMatches(Node p)
           
 boolean sameAs(Node s, Node p, Node o)
          Answer true iff this triple has subject s, predicate p, and object o.
 boolean subjectMatches(Node s)
           
 java.lang.String toString()
          return a human-readable string "subject @predicate object" describing the triple
 java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

subj

private final Node subj

pred

private final Node pred

obj

private final Node obj

cache

protected static TripleCache cache
The cache of already-created triples.


ANY

public static final Triple ANY
Constructor Detail

Triple

public Triple(Node s,
              Node p,
              Node o)
Method Detail

toString

public java.lang.String toString()
return a human-readable string "subject @predicate object" describing the triple


toString

public java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm)

getSubject

public Node getSubject()

getPredicate

public Node getPredicate()

getObject

public Node getObject()

getMatchSubject

public Node getMatchSubject()
Description copied from interface: TripleMatch
If it is known that all triples selected by this filter will have a common subject, return that node, otherwise return null

Specified by:
getMatchSubject in interface TripleMatch

getMatchPredicate

public Node getMatchPredicate()
Description copied from interface: TripleMatch
If it is known that all triples selected by this match will have a common predicate, return that node, otherwise return null

Specified by:
getMatchPredicate in interface TripleMatch

getMatchObject

public Node getMatchObject()
Description copied from interface: TripleMatch
If it is known that all triples selected by this match will have a common object, return that node, otherwise return null

Specified by:
getMatchObject in interface TripleMatch

anyToNull

private static Node anyToNull(Node n)

nullToAny

private static Node nullToAny(Node n)

asTriple

public Triple asTriple()
Description copied from interface: TripleMatch
Answer a Triple capturing this match.

Specified by:
asTriple in interface TripleMatch

isConcrete

public boolean isConcrete()

equals

public boolean equals(java.lang.Object o)
Answer true if o is a Triple with the same subject, predicate, and object as this triple.


sameAs

public boolean sameAs(Node s,
                      Node p,
                      Node o)
Answer true iff this triple has subject s, predicate p, and object o.


matches

public boolean matches(Triple other)

matches

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

matchedBy

private boolean matchedBy(Node s,
                          Node p,
                          Node o)

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 triple is the hash-codes of its components munged together: see hashCode(S, P, O).


hashCode

public static int hashCode(Node s,
                           Node p,
                           Node o)
Return the munged hashCodes of the specified nodes, an exclusive-or of the slightly-shifted component hashcodes; this means (almost) all of the bits count, and the order matters, so (S @P O) has a different hash from (O @P S), etc.


create

public static Triple create(Node s,
                            Node p,
                            Node o)
Factory method for creating triples, allows caching opportunities. Attempts to use triples from the cache, if any suitable ones exist.


createMatch

public static Triple createMatch(Node s,
                                 Node p,
                                 Node o)

create

public static Triple create(java.lang.String fact)
Utility factory method for creating a triple based on the content of an "S P O" string. The S, P, O are processed by Node.create, see which for details of the supported syntax. This method exists to support test code. Nodes are interpreted using the Standard prefix mapping.


create

public static Triple create(com.hp.hpl.jena.shared.PrefixMapping pm,
                            java.lang.String fact)
Utility factory as for create(String), but allowing the PrefixMapping to be specified explicitly.