org.openrdf.sesame.query.rql.model
Class Intersection

java.lang.Object
  extended byorg.openrdf.sesame.query.rql.model.Intersection
All Implemented Interfaces:
Comparable, Resource, Serializable, Value

public class Intersection
extends Object
implements Resource

An intersection of classes.

See Also:
Serialized Form

Constructor Summary
Intersection()
          Creates a new, empty Intersection.
Intersection(StatementIterator statIter)
          Creates a new Intersection that is initialized with the objects of the statements from the supplied StatementIterator.
 
Method Summary
 void add(Resource resource)
          Adds a resource to this intersection.
 void addProperty(URI property, Value value)
          Adds a property to this Resource in the RDF graph.
 int compareTo(Object o)
           
 boolean containsInstance(Resource instance, RdfSchemaSource rss)
          Checks if the supplied resource is an instance of all classes of this intersection, using the supplied RdfSchemaSource to check the instance relations.
 boolean equals(Object other)
          Compares this intersection to another object.
 Resource getFirstMember()
           
 ValueIterator getInstances(RdfSchemaSource rss)
          Gets all resources that are instances of all classes of this intersection.
 Set getMembers()
          Gets the members of this intersection.
 StatementIterator getObjectStatements()
          Gets all statements from the RDF graph for which this value is the object.
 StatementIterator getSubjectStatements()
          Gets all statements from the RDF graph for which this resource is the subject.
 boolean greaterEqualThan(Intersection other, RdfSchemaSource rss)
           
 boolean greaterThan(Intersection other, RdfSchemaSource rss)
           
 int hashCode()
          Returns a hashcode for use in hash tables.
 boolean lowerEqualThan(Intersection other, RdfSchemaSource rss)
           
 boolean lowerThan(Intersection other, RdfSchemaSource rss)
           
 Value minimize(RdfSchemaSource rss)
          Minimizes the set of classes in this intersection by filtering out any superclasses for which there are also subclasseses in this intersection.
 int size()
          Gets the size (number of resources) of this intersection.
 String toString()
          Gives a String-representation of this Intersection that can be used for debugging.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Intersection

public Intersection()
Creates a new, empty Intersection.


Intersection

public Intersection(StatementIterator statIter)
Creates a new Intersection that is initialized with the objects of the statements from the supplied StatementIterator. The StatementIterator will be closed when all its elements have been read.

Method Detail

getMembers

public Set getMembers()
Gets the members of this intersection.

Returns:
a Set of Resource objects.

getFirstMember

public Resource getFirstMember()

add

public void add(Resource resource)
Adds a resource to this intersection. The resource will be ignored if it is already in the intersection.

Parameters:
resource - A Resource representing a class.

minimize

public Value minimize(RdfSchemaSource rss)
Minimizes the set of classes in this intersection by filtering out any superclasses for which there are also subclasseses in this intersection.

Parameters:
rss - The RdfSchemaSource to use for checking the sub-superclass relations.

size

public int size()
Gets the size (number of resources) of this intersection.


containsInstance

public boolean containsInstance(Resource instance,
                                RdfSchemaSource rss)
Checks if the supplied resource is an instance of all classes of this intersection, using the supplied RdfSchemaSource to check the instance relations.


getInstances

public ValueIterator getInstances(RdfSchemaSource rss)
Gets all resources that are instances of all classes of this intersection.


equals

public boolean equals(Object other)
Compares this intersection to another object.

Parameters:
other - The Object to compare ths intersection to.
Returns:
true if this intersection is equal to the supplied object, false otherwise.

lowerEqualThan

public boolean lowerEqualThan(Intersection other,
                              RdfSchemaSource rss)

greaterThan

public boolean greaterThan(Intersection other,
                           RdfSchemaSource rss)

greaterEqualThan

public boolean greaterEqualThan(Intersection other,
                                RdfSchemaSource rss)

lowerThan

public boolean lowerThan(Intersection other,
                         RdfSchemaSource rss)

hashCode

public int hashCode()
Returns a hashcode for use in hash tables.


compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

toString

public String toString()
Gives a String-representation of this Intersection that can be used for debugging.


addProperty

public void addProperty(URI property,
                        Value value)
                 throws GraphException
Description copied from interface: Resource
Adds a property to this Resource in the RDF graph. The result is that a statement of the form (this, property, value) is added.

Specified by:
addProperty in interface Resource
Parameters:
property - the predicate of the statement that should be added.
value - the value of the statements that should be added.
Throws:
GraphException

getSubjectStatements

public StatementIterator getSubjectStatements()
                                       throws GraphException
Description copied from interface: Resource
Gets all statements from the RDF graph for which this resource is the subject.

Specified by:
getSubjectStatements in interface Resource
Throws:
GraphException

getObjectStatements

public StatementIterator getObjectStatements()
                                      throws GraphException
Description copied from interface: Value
Gets all statements from the RDF graph for which this value is the object.

Specified by:
getObjectStatements in interface Value
Throws:
GraphException


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.