001: /*
002: * LICENSE INFORMATION
003: * Copyright 2005-2007 by FZI (http://www.fzi.de).
004: * Licensed under a BSD license (http://www.opensource.org/licenses/bsd-license.php)
005: * <OWNER> = Max Völkel
006: * <ORGANIZATION> = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe, Germany
007: * <YEAR> = 2007
008: *
009: * Project information at http://semweb4j.org/rdf2go
010: */
011: package org.ontoware.rdf2go.model;
012:
013: import org.ontoware.rdf2go.exception.ModelRuntimeException;
014: import org.ontoware.rdf2go.model.node.BlankNode;
015: import org.ontoware.rdf2go.model.node.DatatypeLiteral;
016: import org.ontoware.rdf2go.model.node.LanguageTagLiteral;
017: import org.ontoware.rdf2go.model.node.Node;
018: import org.ontoware.rdf2go.model.node.PlainLiteral;
019: import org.ontoware.rdf2go.model.node.Resource;
020: import org.ontoware.rdf2go.model.node.URI;
021:
022: /**
023: * Factory-like parts of an RDF2Go-Model
024: *
025: * @author voelkel
026: *
027: */
028: public interface ModelValueFactory {
029:
030: /**
031: * Create (but do not add) a new blank node
032: * @return a new blank node
033: */
034: BlankNode createBlankNode();
035:
036: /**
037: * Create a new blank node with the given internal ID. The id should be one
038: * returned from BlankNode.getInternalID().
039: * @param internalID
040: * @return a BlankNode with the given internal ID.
041: * @throws UnsupportedOperationException
042: * if the underlying store cannot create BlankNodes from IDs.
043: * @throws IllegalArgumentException
044: * if the internalID could not be used
045: */
046: BlankNode createBlankNode(String internalID);
047:
048: /**
049: * The model must create URIs it would accept itself.
050: *
051: * @return a new URI from the given String
052: * @throws IllegalArgumentException,
053: * e.g. if URI is invalid
054: */
055: URI createURI(String uriString) throws IllegalArgumentException;
056:
057: /**
058: * CHecks URI for syntax errors.
059: * @param uriString
060: * @return true if the URI is valid for the given implementation
061: */
062: boolean isValidURI(String uriString);
063:
064: /**
065: * Create a new plain literal
066: * @param literal
067: * @return a PlainLiteral
068: */
069: PlainLiteral createPlainLiteral(String literal);
070:
071: /**
072: * @param literal
073: * @param langugeTag
074: * @return a LanguageTagLiteral
075: * @throws ModelRuntimeException
076: * e.g. if the language tag is malformed
077: */
078: LanguageTagLiteral createLanguageTagLiteral(String literal,
079: String langugeTag) throws ModelRuntimeException;
080:
081: /**
082: * @param literal
083: * @param datatypeURI
084: * @return a DatatypeLiteral
085: * @throws ModelRuntimeException
086: * e.g. if the datatype URI causes problems
087: */
088: DatatypeLiteral createDatatypeLiteral(String literal,
089: URI datatypeURI) throws ModelRuntimeException;
090:
091: /**
092: * Create a new statement - but DOES NOT add it to the model
093: * @param subject
094: * @param predicate
095: * @param object
096: * @return a Statement
097: */
098: Statement createStatement(Resource subject, URI predicate,
099: Node object);
100:
101: /**
102: * Implementations are free to choose if their semantics are unique within
103: * the this model, the ModelSet, or unique in the universe
104: *
105: * @return a new, unique URI
106: */
107: URI newRandomUniqueURI();
108:
109: }
|