org.openanzo.model.impl
Class AnzoValueFactory

java.lang.Object
  extended by org.openanzo.model.impl.AnzoValueFactory
All Implemented Interfaces:
org.openrdf.model.ValueFactory

public class AnzoValueFactory
extends java.lang.Object
implements org.openrdf.model.ValueFactory

Anzo implementation of ValueFactory

  • Contains weakHashMaps for caching uris, literals, typedLiterals, and bNodes.
  • Has a createTypedLiteral method, which sets datatype for literals on creation
  • Uses random uuid for bnodes to prevent clashes

    Author:
    Matthew Roy ( mroy@cambridgesemantics.com )

    Constructor Summary
    AnzoValueFactory()
               
     
    Method Summary
     org.openrdf.model.BNode createBNode()
               
     org.openrdf.model.BNode createBNode(java.lang.String id)
               
     org.openrdf.model.Literal createLiteral(boolean arg0)
               
     org.openrdf.model.Literal createLiteral(byte arg0)
               
     org.openrdf.model.Literal createLiteral(double arg0)
               
     org.openrdf.model.Literal createLiteral(float arg0)
               
     org.openrdf.model.Literal createLiteral(int arg0)
               
     org.openrdf.model.Literal createLiteral(long arg0)
               
     org.openrdf.model.Literal createLiteral(short arg0)
               
     org.openrdf.model.Literal createLiteral(java.lang.String label)
               
     org.openrdf.model.Literal createLiteral(java.lang.String label, java.lang.String lang)
               
     org.openrdf.model.Literal createLiteral(java.lang.String label, org.openrdf.model.URI dataType)
               
     org.openrdf.model.Literal createLiteral(javax.xml.datatype.XMLGregorianCalendar arg0)
               
     org.openrdf.model.Statement createMatchStatement(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
              Create a statement, replacing any null values with Constants.ANY_URI
     org.openrdf.model.Statement createMatchStatement(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource context)
              Create a statement, replacing any null values with Constants.ANY_URI
     org.openrdf.model.Resource createResource(java.lang.String value)
              Create either a BNode or URI based on contents of value
     org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
               
     org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource context)
               
     org.openrdf.model.Literal createTypedLiteral(java.lang.Object value)
              Create a literal with its datatype set,based on type of object passed in.
     org.openrdf.model.URI createURI(java.lang.String uri)
              Create URI based on uri value.
     org.openrdf.model.URI createURI(java.lang.String namespace, java.lang.String uri)
               
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    AnzoValueFactory

    public AnzoValueFactory()
    Method Detail

    createBNode

    public org.openrdf.model.BNode createBNode()
    Specified by:
    createBNode in interface org.openrdf.model.ValueFactory

    createBNode

    public org.openrdf.model.BNode createBNode(java.lang.String id)
    Specified by:
    createBNode in interface org.openrdf.model.ValueFactory

    createResource

    public org.openrdf.model.Resource createResource(java.lang.String value)
    Create either a BNode or URI based on contents of value

    Parameters:
    value - Value to convert to resource
    Returns:
    Value converted to URI

    createLiteral

    public org.openrdf.model.Literal createLiteral(java.lang.String label)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(java.lang.String label,
                                                   java.lang.String lang)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(java.lang.String label,
                                                   org.openrdf.model.URI dataType)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createTypedLiteral

    public org.openrdf.model.Literal createTypedLiteral(java.lang.Object value)
    Create a literal with its datatype set,based on type of object passed in. Defaults to plain literal with no type if object not known, with a text value of the objects.toString() value.

    Parameters:
    value - Value to convert to literal
    Returns:
    Literal representation of value

    createStatement

    public org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj,
                                                       org.openrdf.model.URI prop,
                                                       org.openrdf.model.Value obj)
    Specified by:
    createStatement in interface org.openrdf.model.ValueFactory

    createStatement

    public org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj,
                                                       org.openrdf.model.URI prop,
                                                       org.openrdf.model.Value obj,
                                                       org.openrdf.model.Resource context)
    Specified by:
    createStatement in interface org.openrdf.model.ValueFactory

    createMatchStatement

    public org.openrdf.model.Statement createMatchStatement(org.openrdf.model.Resource subj,
                                                            org.openrdf.model.URI prop,
                                                            org.openrdf.model.Value obj,
                                                            org.openrdf.model.Resource context)
    Create a statement, replacing any null values with Constants.ANY_URI

    Parameters:
    subj - Subject of statement, or null which is replaced with ANY_URI
    prop - Property of statement, or null which is replaced with ANY_URI
    obj - Object of statement, or null which is replaced with ANY_URI
    context - Context of statement, or null which is replaced with ANY_URI
    Returns:
    Statement with nulls replaced with ANY_URI

    createMatchStatement

    public org.openrdf.model.Statement createMatchStatement(org.openrdf.model.Resource subj,
                                                            org.openrdf.model.URI prop,
                                                            org.openrdf.model.Value obj)
    Create a statement, replacing any null values with Constants.ANY_URI

    Parameters:
    subj - Subject of statement, or null which is replaced with ANY_URI
    prop - Property of statement, or null which is replaced with ANY_URI
    obj - Object of statement, or null which is replaced with ANY_URI
    Returns:
    Statement with nulls replaced with ANY_URI

    createURI

    public org.openrdf.model.URI createURI(java.lang.String uri)
    Create URI based on uri value.

    Specified by:
    createURI in interface org.openrdf.model.ValueFactory
    Parameters:
    uri - string representation of URI
    Returns:
    URI representation of passed in value
    Throws:
    AnzoRuntimeException - if there are any spaces in the URI

    createURI

    public org.openrdf.model.URI createURI(java.lang.String namespace,
                                           java.lang.String uri)
    Specified by:
    createURI in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(boolean arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(byte arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(short arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(int arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(long arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(float arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(double arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory

    createLiteral

    public org.openrdf.model.Literal createLiteral(javax.xml.datatype.XMLGregorianCalendar arg0)
    Specified by:
    createLiteral in interface org.openrdf.model.ValueFactory


    Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.