Semantic MediaWiki and related extensions
|
The SPARQLStore
is the name for the component that can establish a connection between a RDF triple store and Semantic MediaWiki (a more general introduction can be found here).
The SPARQLStore
is composed of a base store (by default using the existing SQLStore
), a QueryEngine
, and a connector to the RDF back-end. Currently, the base store takes the position of accumulating information about properties, value annotations, and statistics.
A repository connector is responsible for establishing a communication between Semantic MediaWiki and an external TDB with the main objective to transfer/update triples from SMW to the back-end and to return result matches for a query request.
The following client repositories have been tested:
### Create a connection
$connectionManager = new ConnectionManager();
$connectionManager->registerConnectionProvider( 'sparql', new RepositoryConnectionProvider( 'fuseki' ) );
$connection = $connectionManager->getConnection( 'sparql' )
The QueryEngine
is responsible for transforming an #ask
description object into a qualified SPARQL
query expression.
ConditionBuilder
builds a SPARQL condition from an #ask
query artefact (aka Description
object)SPARQL
statement for which the repository connector is making a http request to the back-end while awaiting an expected list of subjects that matched the condition in form of a XML
or JSON
responseHttpResponseParser
to provide a unified RepositoryResult
objectQueryResultFactory
converts the RepositoryResult
into a SMW specific QueryResult
object which will fetch the remaining data (those selected as printrequests) from the base store and make them available to a QueryResultPrinter
### Create a query request
/** * Equivalent to [[Foo::+]] * * SELECT DISTINCT ?result WHERE { * ?result swivt:wikiPageSortKey ?resultsk . * ?result property:Foo ?v1 . * } * ORDER BY ASC(?resultsk) */ $description = new SomeProperty( new DIProperty( 'Foo' ), new ThingDescription() );
$query = new Query( $description );
$sparqlStoreFactory = new SPARQLStoreFactory( new SPARQLStore() );
$queryEngine = $sparqlStoreFactory->newMasterQueryEngine(); $queryResult = $queryEngine->getQueryResult( $query );