|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.hpl.jena.rdf.model.ResourceFactory
public class ResourceFactory
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 |
createLangLiteral(String string,
String lang)
Answer a plain (untyped) literal with no language and the given content. |
static Literal |
createPlainLiteral(String string)
Answer a plain (untyped) literal with no language and the given content. |
static Property |
createProperty(String uriref)
create a new property. |
static Property |
createProperty(String namespace,
String localName)
create a new property. |
static Resource |
createResource()
create a new anonymous resource. |
static Resource |
createResource(String uriref)
create a new resource. |
static Statement |
createStatement(Resource subject,
Property predicate,
RDFNode object)
create a new statement. |
static Literal |
createTypedLiteral(Object value)
Answer a typed literal. |
static Literal |
createTypedLiteral(String string,
RDFDatatype dType)
Answer a typed literal. |
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 |
---|
public static ResourceFactory.Interface getInstance()
public static ResourceFactory.Interface setInstance(ResourceFactory.Interface newInstance)
newInstance
- the new factory object
public static Resource createResource()
Uses the current factory object to create a new anonymous resource.
public static Resource createResource(String uriref)
Uses the current factory object to create a new resource.
uriref
- URIREF of the resource
public static Literal createPlainLiteral(String string)
string
- the string which forms the value of the literal
public static Literal createLangLiteral(String string, String lang)
string
- the string which forms the value of the literallang
- The language tag to be used
public static Literal createTypedLiteral(String string, RDFDatatype dType)
string
- the string which forms the value of the literaldType
- RDFDatatype of the type literal
public static Literal createTypedLiteral(Object value)
value
- a java Object, the default RDFDatatype for that object will be used
public static Property createProperty(String uriref)
Uses the current factory object to create a new resource.
uriref
- URIREF of the property
public static Property createProperty(String namespace, String localName)
Uses the current factory object to create a new property.
namespace
- URIREF of the namespace of the propertylocalName
- localname of the property
public static Statement createStatement(Resource subject, Property predicate, RDFNode object)
subject
- the subject of the new statementpredicate
- the predicate of the new statementobject
- the objectof the new statement
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |