owmeta_core.data module¶
- class owmeta_core.data.Data(conf=None, **kwargs)[source]¶
Bases:
Configuration
Provides configuration for access to the database.
Usually doesn’t need to be accessed directly
- rdf.graph¶
An RDFLib
ConjunctiveGraph
, possibly aDataset
. Configured according tordf.source
and any other variables used by theRDFSource
corresponding
- rdf.namespace¶
Default namespace bound to an empty string in the the namespace manager,
rdf.namespace_manager
- rdf.namespace_manager¶
RDFLib Namespace Manager. Typically, this is generated automatically during a call to
init
- rdf.namespace_manager.store¶
RDFLib store name specific to namespaces
- rdf.namespace_manager.store_conf¶
Configuration for RDFLib store specified with
rdf.namespace_manager.store
- transaction_manager.provider¶
A
provider
for a transaction manager. Provider must resolve to acallable
that accepts aData
instance.
- transaction_manager¶
Transaction manager for RDFLib stores. Provided by
transaction_manager.provider
if that’s defined. Should be passed toIDataManager
instances within the scope of a givenData
instance.
- Parameters
- conf
Configuration
The base configuration from which this configuration will be built. This configuration will be copied into this one, but no direct reference will be retained
- conf
- close()¶
Close a the configured database
- closeDatabase()¶
Close a the configured database
- init_database()¶
Open the configured database
- classmethod load(file_name)[source]¶
Load a file into a new Data instance storing configuration in a JSON format
- class owmeta_core.data.DataUser(*args, **kwargs)[source]¶
Bases:
Configurable
A convenience wrapper for users of the database
Classes which use the database should inherit from DataUser.
- add_reference(g, reference_iri)[source]¶
Add a citation to a set of statements in the database
- Parameters
triples – A set of triples to annotate
- class owmeta_core.data.DefaultSource(**kwargs)[source]¶
Bases:
RDFSource
Reads from and queries against a configured database.
The default configuration.
The database store is configured with:
"rdf.source" = "default" "rdf.store" = <your rdflib store name here> "rdf.store_conf" = <your rdflib store configuration here>
Leaving unconfigured simply gives an in-memory data store.
- class owmeta_core.data.RDFSource(**kwargs)[source]¶
Bases:
Configurable
,ConfigValue
Base class for data sources.
Alternative sources should derive from this class
- class owmeta_core.data.SPARQLSource(**kwargs)[source]¶
Bases:
RDFSource
Reads from and queries against a remote data store
"rdf.source" = "sparql_endpoint"
- class owmeta_core.data.SleepyCatSource(**kwargs)[source]¶
Bases:
RDFSource
Reads from and queries against a local Sleepycat database
The database can be configured like:
"rdf.source" = "Sleepycat" "rdf.store_conf" = <your database location here>
- class owmeta_core.data.ZODBSource(*args, **kwargs)[source]¶
Bases:
RDFSource
Reads from and queries against a configured Zope Object Database.
If the configured database does not exist, it is created.
The database store is configured with:
"rdf.source" = "ZODB" "rdf.store_conf" = <location of your ZODB database>
Leaving unconfigured simply gives an in-memory data store.
- owmeta_core.data.NAMESPACE_MANAGER_KEY = 'rdf.namespace_manager'¶
Constant for
rdf.namespace_manager
- owmeta_core.data.NAMESPACE_MANAGER_STORE_CONF_KEY = 'rdf.namespace_manager.store_conf'¶
Constant for
rdf.namespace_manager.store_conf
- owmeta_core.data.NAMESPACE_MANAGER_STORE_KEY = 'rdf.namespace_manager.store'¶
Constant for
rdf.namespace_manager.store
- owmeta_core.data.SOURCES = {'default': <class 'owmeta_core.data.DefaultSource'>, 'mysql': <class 'owmeta_core.data.MySQLSource'>, 'postgresql': <class 'owmeta_core.data.PostgreSQLSource'>, 'sleepycat': <class 'owmeta_core.data.SleepyCatSource'>, 'sparql_endpoint': <class 'owmeta_core.data.SPARQLSource'>, 'sqlite': <class 'owmeta_core.data.SQLiteSource'>, 'zodb': <class 'owmeta_core.data.ZODBSource'>}¶
Table of possible sources for
rdf.source
- owmeta_core.data.TRANSACTION_MANAGER_KEY = 'transaction_manager'¶
Constant for
transaction_manager
- owmeta_core.data.TRANSACTION_MANAGER_PROVIDER_KEY = 'transaction_manager.provider'¶
Constant for
transaction_manager.provider