org.jrdf.graph.mem
Class GraphElementFactoryImpl

java.lang.Object
  extended byorg.jrdf.graph.mem.GraphElementFactoryImpl
All Implemented Interfaces:
GraphElementFactory

public class GraphElementFactoryImpl
extends Object
implements GraphElementFactory

A SkipListNode Factory is a class which create the various components of a graph. It is tied to a specific instance of GraphImpl.

Version:
$Revision: 1.1 $
Author:
Paul Gearon

Method Summary
 Literal createLiteral(String lexicalValue)
          Creates a new literal with the given lexical value, with no language or datatype.
 Literal createLiteral(String lexicalValue, String languageType)
          Creates a new literal with the given lexical value, with a given language but no datatype.
 Literal createLiteral(String lexicalValue, URI datatypeURI)
          Creates a new literal with the given lexical value and given datatype.
 BlankNode createResource()
          Create a blank nodes that is associated with a specific graph.
 URIReference createResource(URI uri)
          Create a URI reference.
 URIReference createResource(URI uri, boolean validate)
          Create a URI reference without checking if the URI given is a valid RDF URI, currently if the URI is absolute.
 Triple createTriple(SubjectNode subject, PredicateNode predicate, ObjectNode object)
          Creates a new triple to be used in the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createResource

public BlankNode createResource()
                         throws GraphElementFactoryException
Create a blank nodes that is associated with a specific graph.

Specified by:
createResource in interface GraphElementFactory
Returns:
A new blank node within the graph.
Throws:
GraphElementFactoryException - If anonymous resources can't be generated.

createResource

public URIReference createResource(URI uri)
                            throws GraphElementFactoryException
Create a URI reference.

Specified by:
createResource in interface GraphElementFactory
Parameters:
uri - The URI of the resource.
Returns:
the newly created URI reference value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createResource

public URIReference createResource(URI uri,
                                   boolean validate)
                            throws GraphElementFactoryException
Create a URI reference without checking if the URI given is a valid RDF URI, currently if the URI is absolute.

Specified by:
createResource in interface GraphElementFactory
Parameters:
uri - The URI of the resource.
validate - true if we disbale checking to see if the URI is valid.
Returns:
The newly created URI reference value.
Throws:
GraphElementFactoryException

createLiteral

public Literal createLiteral(String lexicalValue)
                      throws GraphElementFactoryException
Creates a new literal with the given lexical value, with no language or datatype.

Specified by:
createLiteral in interface GraphElementFactory
Parameters:
lexicalValue - The lexical value for the literal.
Returns:
the newly created literal value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createLiteral

public Literal createLiteral(String lexicalValue,
                             String languageType)
                      throws GraphElementFactoryException
Creates a new literal with the given lexical value, with a given language but no datatype.

Specified by:
createLiteral in interface GraphElementFactory
Parameters:
lexicalValue - The lexical value for the literal. Cannot be null.
languageType - The language of the literal or null if not required.
Returns:
the newly created literal value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createLiteral

public Literal createLiteral(String lexicalValue,
                             URI datatypeURI)
                      throws GraphElementFactoryException
Creates a new literal with the given lexical value and given datatype.

Specified by:
createLiteral in interface GraphElementFactory
Parameters:
lexicalValue - The lexical value for the literal. Cannot be null.
datatypeURI - The URI of the datatype of the literal or null if not required.
Returns:
the newly created literal value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createTriple

public Triple createTriple(SubjectNode subject,
                           PredicateNode predicate,
                           ObjectNode object)
                    throws GraphElementFactoryException
Creates a new triple to be used in the graph. Does not add it to the graph. Use @see Graph#add.

Specified by:
createTriple in interface GraphElementFactory
Parameters:
subject - The subject of the statement.
predicate - The predicate of the statement.
object - The object of the statement.
Returns:
the newly created triple object.
Throws:
GraphElementFactoryException - If the resource failed to be created.