Olivier Corby, INRIA, Novembre 2008.
See also:
Corese
Corese have the notions of Event and Event Listener that enable users to trap some predefined events.
Interesting for type checking RDF Schema and RDF metadata wrt RDF Schema
EngineFactory ef = new EngineFactory();
IEngine engine = ef.newInstance();
engine.validate("onto.rdfs")
engine.validate("data.rdf")
for (Event e : engine.report()){
System.out.println(e);
}
Event Listeners implement the EventListener interface and specifically the send method shown below, that can be specialized in a user defined Listener subclass.
void send(Event e);
Events related to RDF/S document loading.
engine.addEventListener(LoadListener.create());
The Event contains the triple being loaded. The send method of the listener may invalidate the Event using the function call shown below. In this case the triple is withdrawn from loading.
event.setValid(false)
It is possible to modify/correct the triple on the fly in the listener using the API shown below. This enables users to correct RDF triples that would not be correct otherwise, to leverage or validate RDF wrt RDF Schema, to cast literals to target datatype, etc.
Triple t = (Triple) event.getObject(); t.setSource(aSource); t.setResource(aResource); t.setProperty(aProperty); t.setValue(aValue); t.setDatatype(aDatatype); t.setLang(aLang);
Events related to SPARQL query processing.
engine.addEventListener(QueryListener.create());
It is possible to skip some events processing in a listener.
EventListener el = QueryListener.create(); el.handle(Event.PROJ_EVAL, false);
Events related to inference rules.
engine.addEventListener(RuleListener.create());
The EventListenerImpl class implements the EventListener interface and does nothing. Users can specialize this class to design their own listners by refining specific methods, specifically the send method.
class MyListener extends EventListenerImpl {
void send(Event e){
System.out.println(e);
}
}