org.jrdf.graph
Interface GraphElementFactory

All Known Implementing Classes:
GraphElementFactoryImpl

public interface GraphElementFactory

A Graph Element Factory is a class which creates the various components of a graph including: resources, literals and blank nodes. It is generally tied to a specific graph (in the case of blank nodes it must be).

Version:
$Revision: 1045 $
Author:
Andrew Newman

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.
 

Method Detail

createResource

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

Returns:
the newly created blank node value.
Throws:
GraphElementFactoryException - if adding a blank node fails.

createResource

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

Parameters:
uri - The URI of the resource.
Returns:
the newly created URI reference value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createResource

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.

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

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

Parameters:
lexicalValue - The lexical value for the literal.
Returns:
the newly created literal value.
Throws:
GraphElementFactoryException - If the resource failed to be created.

createLiteral

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

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

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

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.