org.jrdf.graph.local
Class GraphElementFactoryImpl

java.lang.Object
  extended by org.jrdf.graph.local.GraphElementFactoryImpl
All Implemented Interfaces:
GraphElementFactory

public final class GraphElementFactoryImpl
extends Object
implements GraphElementFactory

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

Version:
$Revision: 1884 $
Author:
Paul Gearon, Andrew Newman

Method Summary
 BlankNode createBlankNode()
          Create a blank node that is associated with a specific graph.
 Literal createLiteral(Object object)
          Converts a known Java class (such as Integer) into an RDF literal (XSD:int).
 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.
 Resource createResource()
          Create a resource, wrapping a blank node that is associated with a specific graph.
 Resource createResource(BlankNode node)
          Wrap a blank node in a resource.
 Resource createResource(URI uri)
          Create a URI reference wrapped in a Resource.
 Resource createResource(URI uri, boolean validate)
          Create a URI reference wrapped in a Resource without checking if the URI given is a valid RDF URI, currently if the URI is absolute.
 Resource createResource(URIReference node)
          Wrap a URIReference in a resource.
 URIReference createURIReference(URI uri)
          Create a URI reference.
 URIReference createURIReference(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createResource

public Resource createResource()
                        throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a resource, wrapping a blank node that is associated with a specific graph.

Specified by:
createResource in interface GraphElementFactory
Returns:
the newly created resource wrapping a blank node value.
Throws:
GraphElementFactoryException - if adding a blank node fails.

createResource

public Resource createResource(BlankNode node)
                        throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Wrap a blank node in a resource.

Specified by:
createResource in interface GraphElementFactory
Parameters:
node - the node to wrap.
Returns:
a new resource.
Throws:
GraphElementFactoryException - if the blank node does not exist.

createResource

public Resource createResource(URIReference node)
                        throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Wrap a URIReference in a resource.

Specified by:
createResource in interface GraphElementFactory
Parameters:
node - the node to wrap.
Returns:
a new resource.
Throws:
GraphElementFactoryException - if the URIReference does not exist.

createResource

public Resource createResource(URI uri)
                        throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a URI reference wrapped in a Resource.

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

createResource

public Resource createResource(URI uri,
                               boolean validate)
                        throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a URI reference wrapped in a Resource 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 - If the resource failed to be created.

createBlankNode

public BlankNode createBlankNode()
                          throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a blank node that is associated with a specific graph.

Specified by:
createBlankNode in interface GraphElementFactory
Returns:
the newly created blank node value.
Throws:
GraphElementFactoryException - if adding a blank node fails.

createURIReference

public URIReference createURIReference(URI uri)
                                throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a URI reference. Checks the validity of the URI (must be absolute).

Specified by:
createURIReference 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.

createURIReference

public URIReference createURIReference(URI uri,
                                       boolean validate)
                                throws GraphElementFactoryException
Description copied from interface: GraphElementFactory
Create a URI reference without checking if the URI given is a valid RDF URI, currently if the URI is absolute.

Specified by:
createURIReference 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 - If the resource failed to be created.

createLiteral

public Literal createLiteral(Object object)
Description copied from interface: GraphElementFactory
Converts a known Java class (such as Integer) into an RDF literal (XSD:int).

Specified by:
createLiteral in interface GraphElementFactory
Parameters:
object - the value object (a Java class) to create the literal from.
Returns:
the newly created literal value.

createLiteral

public Literal createLiteral(String lexicalValue)
Description copied from interface: GraphElementFactory
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.

createLiteral

public Literal createLiteral(String lexicalValue,
                             String languageType)
Description copied from interface: GraphElementFactory
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.

createLiteral

public Literal createLiteral(String lexicalValue,
                             URI datatypeURI)
Description copied from interface: GraphElementFactory
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.