Class SchemaCachingRDFSInferencer
- All Implemented Interfaces:
FederatedServiceResolverClient, NotifyingSail, Sail, StackableSail
The SchemaCachingRDFSInferencer is an RDFS reasoner that caches all schema (TBox) statements and calculates an inference map to quickly determine inferred statements. The reasoner can also be instantiated with a predefined schema for improved performance.
This reasoner is not a rule based reasoner and will be up to 80x faster than the
invalid reference
ForwardChainingRDFSInferencer
The sail puts no limitations on isolation level for read transactions, however all write/delete/update transactions are serializable with exclusive locks. This limits write/delete/update transactions to one transaction at a time.
- Author:
- HÃ¥vard Mikkelsen Ottestad
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a new SchemaCachingRDFSInferencerInstantiate a SchemaCachingRDFSInferencer.SchemaCachingRDFSInferencer(NotifyingSail data, boolean useAllRdfsRules) Instantiate a SchemaCachingRDFSInferencer.SchemaCachingRDFSInferencer(NotifyingSail data, Repository predefinedSchema) Instantiate a SchemaCachingRDFSInferencer with a predefined schema.SchemaCachingRDFSInferencer(NotifyingSail data, Repository predefinedSchema, boolean useAllRdfsRules) Instantiate a SchemaCachingRDFSInferencer with a predefined schema. -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaCachingRDFSInferencerfastInstantiateFrom(SchemaCachingRDFSInferencer sailToInstantiateFrom, NotifyingSail store) Instantiate a new SchemaCachingRDFSInferencer from an existing one.static SchemaCachingRDFSInferencerfastInstantiateFrom(SchemaCachingRDFSInferencer sailToInstantiateFrom, NotifyingSail store, boolean useAllRdfsRules) Instantiate a new SchemaCachingRDFSInferencer from an existing one.Opens a connection on the Sail which can be used to query and update data.Retrieves the defaultIsolationLevellevel on which transactions in this Sail operate.Gets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.voidinit()Initializes the Sail.booleanInferred statements can either be added to the default context or to the context that the original inserted statement has.voidsetAddInferredStatementsToDefaultContext(boolean addInferredStatementsToDefaultContext) Inferred statements can either be added to the default context or to the context that the original inserted statement has. setAddInferredStatementsToDefaultContext(true) will add all inferred statements to the default context.Methods inherited from class NotifyingSailWrapper
addSailChangedListener, getBaseSail, removeSailChangedListener, setBaseSailModifier and TypeMethodDescriptionvoidaddSailChangedListener(SailChangedListener listener) Adds the specified SailChangedListener to receive events when the data in this Sail object changes.Gets the base Sail that this Sail works on top of.voidremoveSailChangedListener(SailChangedListener listener) Removes the specified SailChangedListener so that it no longer receives events from this Sail object.voidsetBaseSail(Sail baseSail) Sets the base Sail that this Sail will work on top of.Methods inherited from class SailWrapper
getCollectionFactory, getDataDir, getFederatedServiceResolver, getSupportedIsolationLevels, isWritable, setDataDir, setFederatedServiceResolver, shutDown, verifyBaseSailSetModifier and TypeMethodDescriptionGets a CollectionFactory that may be optimized for this store and may or may not use disk or other resources.Gets the Sail's data directory.Gets theFederatedServiceResolverused by this client.Retrieve theIsolationLevels supported by this SAIL, ordered by increasing complexity.booleanChecks whether this Sail object is writable, i.e. if the data contained in this Sail object can be changed.voidsetDataDir(File dataDir) Sets the data directory for the Sail.voidSets theFederatedServiceResolverto use for this client.voidshutDown()Shuts down the Sail, giving it the opportunity to synchronize any stale data.protected void
-
Field Details
-
useInferredToCreateSchema
protected volatile boolean useInferredToCreateSchema
-
-
Constructor Details
-
SchemaCachingRDFSInferencer
public SchemaCachingRDFSInferencer()Instantiate a new SchemaCachingRDFSInferencer -
SchemaCachingRDFSInferencer
Instantiate a SchemaCachingRDFSInferencer.- Parameters:
data- Base sail for storing data.
-
SchemaCachingRDFSInferencer
Instantiate a SchemaCachingRDFSInferencer with a predefined schema. The schema will be used for inference, all other schema statements added will be ignored and no schema statements can be removed. Using a predefined schema significantly improves performance.- Parameters:
data- Base sail for storing data.predefinedSchema- Repository containing the schema.
-
SchemaCachingRDFSInferencer
Instantiate a SchemaCachingRDFSInferencer.- Parameters:
data- Base sail for storing data.useAllRdfsRules- Usel all RDFS rules. If set to false rule rdf4a and rdfs4b will be ignore
-
SchemaCachingRDFSInferencer
public SchemaCachingRDFSInferencer(NotifyingSail data, Repository predefinedSchema, boolean useAllRdfsRules) Instantiate a SchemaCachingRDFSInferencer with a predefined schema. The schema will be used for inference, all other schema statements added will be ignored and no schema statements can be removed. Using a predefined schema significantly improves performance.- Parameters:
data- Base sail for storing data.predefinedSchema- Repository containing the schema.useAllRdfsRules- Usel all RDFS rules. If set to false rule rdf4a and rdfs4b will be ignore
-
-
Method Details
-
init
Description copied from interface:SailInitializes the Sail. Care should be taken that required initialization parameters have been set before this method is called. Please consult the specific Sail implementation for information about the relevant parameters.- Specified by:
initin interfaceSail- Overrides:
initin classSailWrapper- Throws:
SailException- If the Sail could not be initialized.
-
getConnection
Description copied from interface:SailOpens a connection on the Sail which can be used to query and update data. Depending on how the implementation handles concurrent access, a call to this method might block when there is another open connection on this Sail.- Specified by:
getConnectionin interfaceNotifyingSail- Specified by:
getConnectionin interfaceSail- Overrides:
getConnectionin classNotifyingSailWrapper- Throws:
SailException- If no transaction could be started, for example because the Sail is not writable.
-
getValueFactory
Description copied from interface:SailGets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.- Specified by:
getValueFactoryin interfaceSail- Overrides:
getValueFactoryin classSailWrapper- Returns:
- a ValueFactory object for this Sail object.
-
fastInstantiateFrom
public static SchemaCachingRDFSInferencer fastInstantiateFrom(SchemaCachingRDFSInferencer sailToInstantiateFrom, NotifyingSail store) Instantiate a new SchemaCachingRDFSInferencer from an existing one. Fast instantiation extracts the schema lookup tables generated by the existing sail and uses them to populate the lookup tables of a new reasoner. Schema triples can not be queried in the SchemaCachingRDFSInferencer returned by this method.- Parameters:
sailToInstantiateFrom- The SchemaCachingRDFSInferencer to extract the lookup tables from.store- Base sail for storing data.- Returns:
- inferencer
-
fastInstantiateFrom
public static SchemaCachingRDFSInferencer fastInstantiateFrom(SchemaCachingRDFSInferencer sailToInstantiateFrom, NotifyingSail store, boolean useAllRdfsRules) Instantiate a new SchemaCachingRDFSInferencer from an existing one. Fast instantiation extracts the schema lookup tables generated by the existing sail and uses them to populate the lookup tables of a new reasoner. Schema triples can not be queried in the SchemaCachingRDFSInferencer returned by this method.- Parameters:
sailToInstantiateFrom- The SchemaCachingRDFSInferencer to extract the lookup tables from.store- Base sail for storing data.useAllRdfsRules- Use all RDFS rules. If set to false rule rdf4a and rdfs4b will be ignore- Returns:
- inferencer
-
getDefaultIsolationLevel
Description copied from interface:SailRetrieves the defaultIsolationLevellevel on which transactions in this Sail operate.- Specified by:
getDefaultIsolationLevelin interfaceSail- Overrides:
getDefaultIsolationLevelin classSailWrapper- Returns:
- the
IsolationLevelthat will be used withSailConnection.begin(), for SAIL connections returned bySail.getConnection().
-
isAddInferredStatementsToDefaultContext
public boolean isAddInferredStatementsToDefaultContext()Inferred statements can either be added to the default context or to the context that the original inserted statement has.
-
setAddInferredStatementsToDefaultContext
public void setAddInferredStatementsToDefaultContext(boolean addInferredStatementsToDefaultContext) Inferred statements can either be added to the default context or to the context that the original inserted statement has. setAddInferredStatementsToDefaultContext(true) will add all inferred statements to the default context.
Which context a tbox statement is added to is undefined.
Before 3.0 default value for addInferredStatementsToDefaultContext was true. From 3.0 the default value is false.
- Parameters:
addInferredStatementsToDefaultContext-
-