|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.context.che.database.impl.SesameBackend
public class SesameBackend
Implementation of Backend
that
uses Sesame to store and retrieve the context events in/from an underlying
store server (a SAIL in Sesame). In this case it uses the Sesame native
Filesystem repository, interfaced with a forward chaining RDFS inferencer.
Field Summary | |
---|---|
protected MessageContentSerializer |
uAALParser
uaal-turtle parser. |
Constructor Summary | |
---|---|
SesameBackend()
|
Method Summary | |
---|---|
void |
close()
Closes the connection to the store. |
void |
connect()
Establishes the connection to the store. |
void |
populate()
Fills the initial store with the OWL data of the ontologies from the OWL files in the config folder (or registered in the system). |
String |
queryBySPARQL(String input)
Returns the result of a SPARQL query issued to the underlying store. |
void |
removeOldEvents(long tst)
Removes all events from the underlying store that were received until the specified timestamp. |
ArrayList |
retrieveEvent(String subject,
String subjecttype,
String predicate,
Object object,
Integer confidence,
Long expiration,
Object provider,
Long tstamp)
Retrieves a list of ContextEvent from the
underlying store, which members are the context events that match the
parameters passed. |
ArrayList |
retrieveEventsBetweenTstmp(String subject,
String subjecttype,
String predicate,
Object object,
Integer confidence,
Long expiration,
ContextProvider provider,
Long tstamp,
Long tstfrom,
Long tstto)
Retrieves a list of ContextEvent from the
underlying store, which members are the context events that match the
parameters passed, and were received within the specified time range. |
ArrayList |
retrieveEventsBySPARQL(String input)
Retrieves a list of ContextEvent from the
underlying store, as a result of a SPARQL query. |
ArrayList |
retrieveEventsFromTstmp(String subject,
String subjecttype,
String predicate,
Object object,
Integer confidence,
Long expiration,
ContextProvider provider,
Long tstamp,
Long tstfrom)
Retrieves a list of ContextEvent from the
underlying store, which members are the context events that match the
parameters passed, and were received after the specified timestamp. |
ArrayList |
retrieveEventsToTstmp(String subject,
String subjecttype,
String predicate,
Object object,
Integer confidence,
Long expiration,
ContextProvider provider,
Long tstamp,
Long tstto)
Retrieves a list of ContextEvent from the
underlying store, which members are the context events that match the
parameters passed, and were received before the specified timestamp. |
void |
setuAALParser(MessageContentSerializer service)
Set the MessageContentSerializer universAAL Parser that can be used to serialize and parse RDF data to universAAL data and vice-versa. |
void |
storeEvent(ContextEvent e)
Stores a ContextEvent in the
underlying store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MessageContentSerializer uAALParser
Constructor Detail |
---|
public SesameBackend()
Method Detail |
---|
public void connect()
Backend
connect
in interface Backend
public void populate() throws org.openrdf.repository.RepositoryException, org.openrdf.rio.RDFParseException, IOException
Backend
populate
in interface Backend
org.openrdf.repository.RepositoryException
org.openrdf.rio.RDFParseException
IOException
public void close()
Backend
close
in interface Backend
public void storeEvent(ContextEvent e)
Backend
ContextEvent
in the
underlying store.
storeEvent
in interface Backend
e
- The context event to be stored.public String queryBySPARQL(String input)
Backend
queryBySPARQL
in interface Backend
input
- The SPARQL query to be executed.
public ArrayList retrieveEventsBySPARQL(String input)
Backend
ContextEvent
from the
underlying store, as a result of a SPARQL query.
retrieveEventsBySPARQL
in interface Backend
input
- The SPARQL query that defines the events to be returned. The
variable that represents the event MUST be named
c
. For instance: "SELECT ?c WHERE {...". Only
SELECT queries are allowed.
public ArrayList retrieveEvent(String subject, String subjecttype, String predicate, Object object, Integer confidence, Long expiration, Object provider, Long tstamp)
Backend
ContextEvent
from the
underlying store, which members are the context events that match the
parameters passed. A parameter can be passed a value of null
for wildcarding.
This is not used in the current version. Will probably be deprecated.
retrieveEvent
in interface Backend
subject
- The URI of the subject of the event to be matchedsubjecttype
- The URI of the type of subject of the event to be matchedpredicate
- The URI of the predicate of the event to be matchedobject
- The Object of the event to be matched. It depends on the
implementer of this method how to match the object.confidence
- The confidence of the event to be matchedexpiration
- The expiration time of the event to be matchedprovider
- The context provider of the event to be matchedtstamp
- The timestamp in milliseconds of the event to be matched
public ArrayList retrieveEventsBetweenTstmp(String subject, String subjecttype, String predicate, Object object, Integer confidence, Long expiration, ContextProvider provider, Long tstamp, Long tstfrom, Long tstto)
Backend
ContextEvent
from the
underlying store, which members are the context events that match the
parameters passed, and were received within the specified time range. A
parameter can be passed a value of null
for wildcarding.
retrieveEventsBetweenTstmp
in interface Backend
subject
- The URI of the subject of the event to be matchedsubjecttype
- The URI of the type of subject of the event to be matchedpredicate
- The URI of the predicate of the event to be matchedobject
- The Object of the event to be matched. It depends on the
implementer of this method how to match the object.confidence
- The confidence of the event to be matchedexpiration
- The expiration time of the event to be matchedprovider
- The context provider of the event to be matchedtstamp
- The timestamp in milliseconds of the event to be matched. If
not null
, only events with this specified
timestamp will be returned, as long as it is inside the time
rangetstfrom
- The timestamp in milliseconds from which events are requested.
Only events stored after this timestamp will be returned.tstto
- The timestamp in milliseconds until which events are
requested. Only events stored before this timestamp will be
returned.
public ArrayList retrieveEventsFromTstmp(String subject, String subjecttype, String predicate, Object object, Integer confidence, Long expiration, ContextProvider provider, Long tstamp, Long tstfrom)
Backend
ContextEvent
from the
underlying store, which members are the context events that match the
parameters passed, and were received after the specified timestamp. A
parameter can be passed a value of null
for wildcarding.
retrieveEventsFromTstmp
in interface Backend
subject
- The URI of the subject of the event to be matchedsubjecttype
- The URI of the type of subject of the event to be matchedpredicate
- The URI of the predicate of the event to be matchedobject
- The Object of the event to be matched. It depends on the
implementer of this method how to match the object.confidence
- The confidence of the event to be matchedexpiration
- The expiration time of the event to be matchedprovider
- The context provider of the event to be matchedtstamp
- The timestamp in milliseconds of the event to be matched. If
not null
, only events with this specified
timestamp will be returned, as long as it is inside the time
range specified by tstinputfrom
tstfrom
- The timestamp in milliseconds from which events are requested.
Only events stored after this timestamp will be returned.
public ArrayList retrieveEventsToTstmp(String subject, String subjecttype, String predicate, Object object, Integer confidence, Long expiration, ContextProvider provider, Long tstamp, Long tstto)
Backend
ContextEvent
from the
underlying store, which members are the context events that match the
parameters passed, and were received before the specified timestamp. A
parameter can be passed a value of null
for wildcarding.
retrieveEventsToTstmp
in interface Backend
subject
- The URI of the subject of the event to be matchedsubjecttype
- The URI of the type of subject of the event to be matchedpredicate
- The URI of the predicate of the event to be matchedobject
- The Object of the event to be matched. It depends on the
implementer of this method how to match the object.confidence
- The confidence of the event to be matchedexpiration
- The expiration time of the event to be matchedprovider
- The context provider of the event to be matchedtstamp
- The timestamp in milliseconds of the event to be matched. If
not null
, only events with this specified
timestamp will be returned, as long as it is inside the time
range specified by tstinputto
tstto
- The timestamp in milliseconds until which events are
requested. Only events stored before this timestamp will be
returned.
public void removeOldEvents(long tst)
Backend
removeOldEvents
in interface Backend
tst
- The timestamp in milliseconds until which events are removed.
A value of 0 does nothing.public void setuAALParser(MessageContentSerializer service)
Backend
setuAALParser
in interface Backend
service
- The MessageContentSerializer service implementation found in
OSGi
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |