The core component of this suite is the SPARQL processing library, which provides the basic querying functionalities.
Backed by this library, a processor related with locations defined using the LOCN vocabulary is provided, namely the LOCN SPARQL processor. Finally, two ready-to-use utilities to show locations retrieved by a SPARQL endpoint is provided: the GoogleMapSPARQLprocessor to show locations on a Google map, and LeafletMapSPARQLprocessor to show locations on a map based on the Leafletjs library.
The DOAP processor allows one to handle projects specified with the DOAP vocabulary.
The Event Processor provide facilities to retrieve and process events described using the Event Ontology.
The DCAT Processor allows one to get all the datasets listed in a repository where these repositories are described using the Data Catalog Vocabulary.
Mainly, the query functionality is provided by the function
with the following signature:
endpoint is the URI (as string) of the endpoint to be queried
queryProcessor is the object
delegate to specify the query and process query results. In more details, the
query, which contains the query which will be performed against the specified endpoint;
process(row)which will be invoked to process each row in the result set (sequentially);
flush()which is called when all the rows in the result have been processed.
The Core Location Vocabulary
provides classes and properties to model physical locations of objects in terms of
addresses and coordinates.
Aside the location data, information about objects located there is useful as well.
In the LOCN SPARQL Processor library a specialized processor for
locn:Location instances is provided.
It allows developers to deal with and process high-level representations
of locations in the RDF store and with the items placed in the location itself. Such a location
defines the following fields:
address- the address in human readable form, which should conform the INSPIRE Data Specification on Geographical Names;
latitude- location latitude;
longitude- location longitute;
locatedItems- an array of physical or abstract items placed in the location.
locatedItems is an array of
LocatedItem instances, i.e. objects with the field
name, indicating the item name, and with the optional field
homepage, which is
the URI of a web page about the item, if provided.
The following HTML
elements can be used to import the LOCN SPARQL processor library in your web page (we remark that
<script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/sparql_processor.js"></script> <script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/locn_sparql_processor.js"></script>
LOCNQueryProcessor, to be used with the
defined in the SPARQL processing library, can be instantiated as follows:
var locnProcessor = new LOCNQueryProcessor(locationQueryProcessor)
locationQueryProcessor is an object which provides
nullif no such constraint is required), which is a string which will be added to the where clause of the query performed to retrieve the
locn:Locationinstances; This parameter can be used to specify additional selection criteria on locations and items; The item must be indicated with the variable
?item; The string MUST NOT end with a dot;
additionalPrefixes, which eventually provides the definition of the prefixes used in
process(location), invoked to handle each
flush(), invoked all the
Locationinstances have been processed.
In the LOCN SPARQL Processor library some ready to
usage examples of the
LOCNQueryProcessor are provided.
GoogleMapsSPARQLProcessor allows a developer to represent
a set of
locn:Location instances, retrieved and selected by querying a
SPARQL endpoint, on a map based on the Google Maps API.
Note that to use this processor you need to load the Google Maps library by means of the following HTML element:
LeafletMapsLOCNProcessor allows one do draw a map with a set of
locn:Location instances by means of the Leafletjs library.
To use this processor you need to load the Leafletjs library and stylesheet as follows:
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"></script>
The DOAP SPARQL Processor is a SPARQL Processor implementation intended to retrieve and process instances of Projects, as defined in the DOAP vocabulary.
To use the DOAP SPARQL processor in your web page add the following elements in the head section of the page itself:
<script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/sparql_processor.js"></script> <script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/doap_sparql_processor.js"></script>
DOAPProcessor instance has to be customized by overriding its
p is in turn an instance of the
isntances have the following attributes:
uri(mandatory) - the URI of the individual representing the project in the ontology;
name(mandatory) - project name;
shortdesc(mandatory) - a short description of the project;
homepage(optional) - the home page of the project;
gitrepo(optional) - the github repository of sources;
desc(optional) - an extended description of the project.
DOAPProcessor constructor has two optional parameters:
additionalConstraints. They can be used to provide additional filtering on the
projects to be processed.
DCATProcessor class can be used to retrieve
dcat:Dataset instances from a knowledge base (via a SPARQL Endpoint),
dcat is the Data Catalog
In order to customize the processing of dataset instances, the
method of the processor has to be implemented. The solely argument of this method
is the dataset to be processed. A
Dataset is an object with the following
URI- the URI of the individual in the knowledge base,
title- the dataset name,
description- (may be null) a description of dataset contents,
landingPage- (may be null) an url of a landing page which allows to access the dataset.
The current version is seminal. Other relevant properties of datasets (see DCAT distribution, for example) will be taken into account in future releases.
In addition, an helper method
additionalPrefixes, additionalConstraints) is provided to create
a processor which will put the retrieved datasets on a html page.
The SPARQL suite provides the
to deal with events provided by a SPARQL endpoint, modeled as described in
Such a processor is based on the delegate pattern, so that each instance of it
must be created with an associated delegate object which will process the
Event objects. In more detail, each
delegate has to implement the methods
processFuture(e). These methods will be invoked to process, respectively,
every past event, the next upcoming event and the other future events. In addition,
flush() method has to be implemented (may be empty) to handle the fact
that there are no more events to be processed.
EventQueryProcessor constructor parameters are such a delegate
and the reference time, which will be used to determine if an event has to be cathegorized
as past or future.
Event objects have the following fields:
URI- the URI of the individual representing the event in the knowledge base,
eventName- a concise and human-readable description of the event,
logo- (may be null) an image which can be used to indicate the event.
timeStart- a string in XSD DateTime format representing the event start time,
timeEnd- (may be null) a string in XSD DateTime format representing the event end time,
address- a human-readable string indicating where the event will take place,
participants- a (possibly empty) array of
posts- a (possibily empty) array of
Postsobjects indicating some posts and web contents related to the event,
photos- a (possibily empty) array of
Photoobjects representing some pictures depicting the event.
To use the Event SPARQL processor in your web page add the following elements in the head section of the page itself:
<script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/sparql_processor.js"></script> <script src="http://dev.opendatasicilia.it/opendatahacklab/sparql_suite/event_sparql_processor.js"></script>
The events page of the opendatahacklab web sites provide a simple usage example of this processor.