Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.rdf.model
Class ResourceFactory

    java.lang.Object
      com.hp.hpl.jena.rdf.model.ResourceFactory

    public class ResourceFactory

extends java.lang.Object

A Factory class for creating resources.

This class creates resources and properties and things of that ilk. These resources are not associated with a user-modifiable model: doing getModel() on them will return null.

It is designed as a singleton. There are static convenience methods on this class itself, so the easy way to create resource is for example to do something like:

       Resource r = ResourceFactory.createResource();

If a factory object is needed, then this can be obtained using the `getInstance` method on the class. The factory object used may be changed using the `setInstance` method.

Nested Class Summary
`static interface` | `ResourceFactory.Interface` the interface to resource factory objects.

Method Summary
`static Literal` | `createPlainLiteral(java.lang.String string)`
`static Property` | `createProperty(java.lang.String uriref)` create a new property.
`static Property` | `createProperty(java.lang.String namespace, java.lang.String localName)` create a new property.
`static Resource` | `createResource()` create a new anonymous resource.
`static Resource` | `createResource(java.lang.String uriref)` create a new resource.
`static Statement` | `createStatement(Resource subject, Property predicate, RDFNode object)` create a new statement.
`static Literal` | `createTypedLiteral(java.lang.Object value)` Answer a typed literal.
`static Literal` | `createTypedLiteral(java.lang.String string, RDFDatatype dType)`
`static ResourceFactory.Interface` | `getInstance()` get the current factory object.
`static ResourceFactory.Interface` | `setInstance(ResourceFactory.Interface newInstance)` set the current factory object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static ResourceFactory.Interface getInstance()

  get the current factory object.

  Returns:
    the current factory object

### setInstance

    public static ResourceFactory.Interface setInstance(ResourceFactory.Interface newInstance)

  set the current factory object.

  Parameters:
    `newInstance` - the new factory object
  Returns:
    the previous factory object

### createResource

    public static Resource createResource()

  create a new anonymous resource.

  Uses the current factory object to create a new anonymous resource.

  Returns:
    a new anonymous resource

### createResource

    public static Resource createResource(java.lang.String uriref)

  create a new resource.

  Uses the current factory object to create a new resource.

  Parameters:
    `uriref` - URIREF of the resource
  Returns:
    a new resource

### createPlainLiteral

    public static Literal createPlainLiteral(java.lang.String string)

### createTypedLiteral

    public static Literal createTypedLiteral(java.lang.String string,
                                             RDFDatatype dType)

### createTypedLiteral

    public static Literal createTypedLiteral(java.lang.Object value)

  Answer a typed literal.

  Parameters:
    `value` - a java Object, the default RDFDatatype for that object will be used
  Returns:
    a Literal node with that value

### createProperty

    public static Property createProperty(java.lang.String uriref)

  create a new property.

  Uses the current factory object to create a new resource.

  Parameters:
    `uriref` - URIREF of the property
  Returns:
    a new property

### createProperty

    public static Property createProperty(java.lang.String namespace,
                                          java.lang.String localName)

  create a new property.

  Uses the current factory object to create a new property.

  Parameters:
    `namespace` - URIREF of the namespace of the property
    `localName` - localname of the property
  Returns:
    a new property

### createStatement

    public static Statement createStatement(Resource subject,
                                            Property predicate,
                                            RDFNode object)

  create a new statement. Uses the current factory object to create a new statement.

  Parameters:
    `subject` - the subject of the new statement
    `predicate` - the predicate of the new statement
    `object` - the objectof the new statement
  Returns:
    a new resource

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP