-
Notifications
You must be signed in to change notification settings - Fork 15
Ad hoc queries to select models and views
In a normal environment with reasonably well structured data, LODSPeaKr can serve data related to different entities, just based on their type: Thus, if the URI requested is rdf:type foaf:Person
, LODSPeaKr will execute the queries for personas and apply the template for persons.
Now, what happens if we have lots of typeless URIs (i.e., we don't have <uri> a :SomeClass
) but we know they represent different types of entities (and thus, they have different properties)? Since version 20120704 it is possible to select models and views based on custom SPARQL queries.
- Run
git pull
to get the latest version of LODSPeaKr - Enable the
sparqlFilter
module- You can run
utils/lodspk.sh enable module sparqlFilter 0
(for performance issues, it would be better to putsparqlFilter
afterservices
but it must to go beforetypes
in the module priority queue. Look at Using lodspk.sh for more info) - Alternatively, you can enable the module by hand, by adding the following line in
settings.inc.php
$conf['modules']['available'] = array('static', 'service', 'sparqlFilter', 'type', 'uri');
- You can run
- Create a directory
components/sparqlFilter
- Inside that folder create a new filter directory, say,
hasDescription
- Inside
haveHomePage
create:
For example, we may want to display all the URIs that have a dcterms:description
by writing the following filter.query
ASK WHERE{
<{{uri}}> dcterms:description []
}
Then, any URI requested that has a dcterms:description
predicate will trigger this module and no other (check Modules for more details on how modules work).
Inside components/sparqlFilter
you can create as many filters as you want, but remember that every filter means a new SPARQL query to be executed.
##Warning
This is a new module, so expect bugs (and please report them)