com.hp.hpl.jena.rdf.model
Class ModelFactory

java.lang.Object
  extended bycom.hp.hpl.jena.rdf.model.ModelFactoryBase
      extended bycom.hp.hpl.jena.rdf.model.ModelFactory

public class ModelFactory
extends ModelFactoryBase

ModelFactory provides methods for creating standard kinds of Model. (ModelFactoryBase is helper functions for it).


Method Summary
static com.hp.hpl.jena.ontology.daml.DAMLModel createDAMLModel()
          Answer a model for processing DAML+OIL, using the legacy Jena1 DAML API.
static Model createDefaultModel()
          construct a new memory-based model with the standard reification style (reification triples contribute to ReifiedStatements, and are visible to listStatements etc).
static ModelMaker createFileModelMaker(java.lang.String root)
          Answer a ModelMaker that constructs memory-based Models that are backed by files in the root directory.
static ModelMaker createFileModelMaker(java.lang.String root, Reifier.Style style)
          Answer a ModelMaker that constructs memory-based Models that are backed by files in the root directory.
static InfModel createInfModel(Reasoner reasoner, Model model)
          Build an inferred model by attaching the given RDF model to the given reasoner.
static InfModel createInfModel(Reasoner reasoner, Model schema, Model model)
          Build an inferred model by attaching the given RDF model to the given reasoner.
static ModelMaker createMemModelMaker()
          Answer a ModelMaker that constructs memory-based Models that do not persist past JVM termination.
static ModelMaker createMemModelMaker(Reifier.Style style)
          Answer a ModelMaker that constructs memory-based Models that do not persist past JVM termination, with the given reification style.
static Model createModelForGraph(Graph g)
          Answer a model that encapsulates the given graph.
static ModelMaker createModelRDBMaker(IDBConnection c)
          Answer a ModelMaker that accesses database-backed Models on the database at the other end of the connection c with the usual Standard reification style.
static ModelMaker createModelRDBMaker(IDBConnection c, Reifier.Style style)
          Answer a ModelMaker that accesses database-backed Models on the database at the other end of the connection c with the given reification style.
static Model createNonreifyingModel()
          construct a new memory-based model that does not capture reification triples (but still handles reifyAs() and .as(ReifiedStatement).
static OntModel createOntologyModel()
           Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL).
static OntModel createOntologyModel(OntModelSpec spec, Model base)
           Answer a new ontology model, constructed according to the given ontology model specification, and starting with the ontology data in the given model.
static OntModel createOntologyModel(OntModelSpec spec, ModelMaker maker, Model base)
           Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL).
static OntModel createOntologyModel(java.lang.String languageURI)
           Answer a new ontology model which will process in-memory models of ontologies in the given language.
static InfModel createRDFSModel(Model model)
          Return a Model through which all the RDFS entailments derivable from the given model are accessible.
static InfModel createRDFSModel(Model schema, Model model)
          Return a Model through which all the RDFS entailments derivable from the given data and schema models are accessible.
static IDBConnection createSimpleRDBConnection()
          Answer a plain IDBConnection to a database, with the arguments implicitly supplied by system properties: The database URL - jena.db.url
The user - jena.db.user, or fails back to "test"
The password - jena.db.password, or fails back to ""
The db type - jena.db.type, or guessed from the URL
static IDBConnection createSimpleRDBConnection(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String dbType)
          Answer a plain IDBConnection to a database with the given URL, with the given user having the given password.
 
Methods inherited from class com.hp.hpl.jena.rdf.model.ModelFactoryBase
extractType, guessDBDriver, guessDBPassword, guessDBType, guessDBURL, guessDBUser
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDefaultModel

public static Model createDefaultModel()
construct a new memory-based model with the standard reification style (reification triples contribute to ReifiedStatements, and are visible to listStatements etc).


createNonreifyingModel

public static Model createNonreifyingModel()
construct a new memory-based model that does not capture reification triples (but still handles reifyAs() and .as(ReifiedStatement).


createModelForGraph

public static Model createModelForGraph(Graph g)
Answer a model that encapsulates the given graph.

Parameters:
g - A graph structure
Returns:
A model presenting an API view of graph g

createFileModelMaker

public static ModelMaker createFileModelMaker(java.lang.String root)
Answer a ModelMaker that constructs memory-based Models that are backed by files in the root directory. The Model is loaded from the file when it is opened, and when the Model is closed it is written back. The model is given the Standard reification style.

Parameters:
root - the name of the directory in which the backing files are held
Returns:
a ModelMaker linked to the files in the root

createFileModelMaker

public static ModelMaker createFileModelMaker(java.lang.String root,
                                              Reifier.Style style)
Answer a ModelMaker that constructs memory-based Models that are backed by files in the root directory. The Model is loaded from the file when it is opened, and when the Model is closed it is written back.

Parameters:
root - the name of the directory in which the backing files are held
style - the desired reification style
Returns:
a ModelMaker linked to the files in the root

createMemModelMaker

public static ModelMaker createMemModelMaker()
Answer a ModelMaker that constructs memory-based Models that do not persist past JVM termination. The model has the Standard reification style.

Returns:
a ModelMaker that constructs memory-based models

createMemModelMaker

public static ModelMaker createMemModelMaker(Reifier.Style style)
Answer a ModelMaker that constructs memory-based Models that do not persist past JVM termination, with the given reification style.

Parameters:
style - the reification style for the model
Returns:
a ModelMaker that constructs memory-based models

createModelRDBMaker

public static ModelMaker createModelRDBMaker(IDBConnection c)
Answer a ModelMaker that accesses database-backed Models on the database at the other end of the connection c with the usual Standard reification style.

Parameters:
c - a connection to the database holding the models
Returns:
a ModelMaker whose Models are held in the database at c

createModelRDBMaker

public static ModelMaker createModelRDBMaker(IDBConnection c,
                                             Reifier.Style style)
Answer a ModelMaker that accesses database-backed Models on the database at the other end of the connection c with the given reification style.

Parameters:
c - a connection to the database holding the models
style - the desired reification style
Returns:
a ModelMaker whose Models are held in the database at c

createSimpleRDBConnection

public static IDBConnection createSimpleRDBConnection(java.lang.String url,
                                                      java.lang.String user,
                                                      java.lang.String password,
                                                      java.lang.String dbType)
Answer a plain IDBConnection to a database with the given URL, with the given user having the given password. For more complex ways of forming a connection, see the DBConnection documentation.

Parameters:
url - the URL of the database
user - the user name to use to access the database
password - the password to use. WARNING: open text.
Returns:
the connection
Throws:
quite - possibly

createSimpleRDBConnection

public static IDBConnection createSimpleRDBConnection()
Answer a plain IDBConnection to a database, with the arguments implicitly supplied by system properties:

The database URL - jena.db.url
The user - jena.db.user, or fails back to "test"
The password - jena.db.password, or fails back to ""
The db type - jena.db.type, or guessed from the URL


createRDFSModel

public static InfModel createRDFSModel(Model model)
Return a Model through which all the RDFS entailments derivable from the given model are accessible. Some work is done when the inferenced model is created but each query will also trigger some additional inference work.

Parameters:
model - the Model containing both instance data and schema assertions to be inferenced over

createRDFSModel

public static InfModel createRDFSModel(Model schema,
                                       Model model)
Return a Model through which all the RDFS entailments derivable from the given data and schema models are accessible. There is no strict requirement to separate schema and instance data between the two arguments.

Parameters:
model - a Model containing instance data assertions
schema - a Model containing RDFS schema data

createInfModel

public static InfModel createInfModel(Reasoner reasoner,
                                      Model model)
Build an inferred model by attaching the given RDF model to the given reasoner.

Parameters:
reasoner - the reasoner to use to process the data
model - the Model containing both instance data and schema assertions to be inferenced over

createInfModel

public static InfModel createInfModel(Reasoner reasoner,
                                      Model schema,
                                      Model model)
Build an inferred model by attaching the given RDF model to the given reasoner.

Parameters:
reasoner - the reasoner to use to process the data
model - a Model containing instance data assertions
schema - a Model containing RDFS schema data

createOntologyModel

public static OntModel createOntologyModel()

Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL). The default document manager will be used to load the ontology's included documents.

Returns:
A new ontology model
See Also:
OntModelSpec

createOntologyModel

public static OntModel createOntologyModel(java.lang.String languageURI)

Answer a new ontology model which will process in-memory models of ontologies in the given language. The default document manager will be used to load the ontology's included documents.

Parameters:
languageURI - The URI specifying the ontology language we want to process
Returns:
A new ontology model
See Also:
OntModelSpec

createOntologyModel

public static OntModel createOntologyModel(OntModelSpec spec,
                                           ModelMaker maker,
                                           Model base)

Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL). The default document manager will be used to load the ontology's included documents.

Parameters:
spec - An ontology model specification that defines the language and reasoner to use
maker - A model maker that is used to get the initial store for the ontology (unless the base model is given), and create addtional stores for the models in the imports closure
base - The base model, which contains the contents of the ontology to be processed
Returns:
A new ontology model
See Also:
OntModelSpec

createOntologyModel

public static OntModel createOntologyModel(OntModelSpec spec,
                                           Model base)

Answer a new ontology model, constructed according to the given ontology model specification, and starting with the ontology data in the given model.

Parameters:
spec - An ontology model specification object, that will be used to construct the ontology model with different options of ontology language, reasoner, document manager and storage model
base - An existing model to treat as an ontology model, or null.
Returns:
A new ontology model
See Also:
OntModelSpec

createDAMLModel

public static com.hp.hpl.jena.ontology.daml.DAMLModel createDAMLModel()

Answer a model for processing DAML+OIL, using the legacy Jena1 DAML API. Users are encouraged to switch from the DAML-specific API to the new generic ontology API (see createOntologyModel(OntModelSpec, Model)). The continuation of the DAML-specific API in Jena is not assured beyond Jena version 2.

Returns:
A model for in-memory processing of DAML objects.


Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.