01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.model.impl;
07:
08: import org.openrdf.model.BNode;
09: import org.openrdf.model.Literal;
10: import org.openrdf.model.Resource;
11: import org.openrdf.model.Statement;
12: import org.openrdf.model.URI;
13: import org.openrdf.model.Value;
14:
15: /**
16: * Default implementation of the ValueFactory interface that uses the RDF model
17: * classes from this package.
18: *
19: * @author Arjohn Kampman
20: */
21: public class ValueFactoryImpl extends ValueFactoryBase {
22:
23: /*-----------*
24: * Constants *
25: *-----------*/
26:
27: private static final ValueFactoryImpl sharedInstance = new ValueFactoryImpl();
28:
29: public static ValueFactoryImpl getInstance() {
30: return sharedInstance;
31: }
32:
33: /*---------*
34: * Methods *
35: *---------*/
36:
37: public URI createURI(String uri) {
38: return new URIImpl(uri);
39: }
40:
41: public URI createURI(String namespace, String localName) {
42: return createURI(namespace + localName);
43: }
44:
45: public BNode createBNode(String nodeID) {
46: return new BNodeImpl(nodeID);
47: }
48:
49: public Literal createLiteral(String value) {
50: return new LiteralImpl(value);
51: }
52:
53: public Literal createLiteral(String value, String language) {
54: return new LiteralImpl(value, language);
55: }
56:
57: public Literal createLiteral(String value, URI datatype) {
58: return new LiteralImpl(value, datatype);
59: }
60:
61: public Statement createStatement(Resource subject, URI predicate,
62: Value object) {
63: return new StatementImpl(subject, predicate, object);
64: }
65:
66: public Statement createStatement(Resource subject, URI predicate,
67: Value object, Resource context) {
68: return new ContextStatementImpl(subject, predicate, object,
69: context);
70: }
71: }
|