EP-SPARQL-queries with getDURATION()

62 views
Skip to first unread message

Hendrik Adler

unread,
Feb 14, 2013, 7:56:52 AM2/14/13
to eta...@googlegroups.com

Hi,


many thanks for your great support so far. I have run into another problem. For me it is not possible to use the EP-SPARQL language if the query includes the filter option “getDURATION()”. Here is the output with the error I get:


ParsedEPQuery: select([var(company)],wheref(seqf([rdf(var(company),hasStockPrice,var(price1))],[rdf(var(company),hasStockPrice,var(price2))]), (var(price1)<var(price2),getDURATION<literal(type((xsd:integer),1)))))

CEPRules: [eventClause(unlabeled,select_event([_G1930]),wheref(seqf(rdf(_G1930,hasStockPrice,_G1960),rdf(_G1930,hasStockPrice,_G1976)), ((_G2021 is _G1960,_G2024 is _G1976,_G2021<_G2024),_G2054 is getDURATION,_G2057 is 1,_G2054<_G2057)))]

*Event: rdf(company1,hasStockPrice,1) @ [datime(2013,2,14,13,36,15,1),datime(2013,2,14,13,36,15,1)]

*Event: rdf(company1,hasStockPrice,2) @ [datime(2013,2,14,13,36,15,2),datime(2013,2,14,13,36,15,2)]

ERROR: Prolog initialisation failed:

ERROR: is/2: Arithmetic: `getDURATION/0' is not a function


It would be great if someone could tell me where the problem is.


Many thanks

Hendrik


This is the code I use:

swipl -g "open('../results.txt',append,FH), ['../../src/ep_sparql/ep_sparql.P'], set_etalis_flag(output_temporary_files,on), set_etalis_flag(logging_to_file,on), set_etalis_flag(store_fired_events,on), ep_sparql_parse('SELECT ?company WHERE { ?company hasStockPrice ?price1 } SEQ { ?company hasStockPrice ?price2 } FILTER (?price1 < ?price2 && getDURATION() < 1)',ParsedEPQuery), assert(external_trigger(select_event/1)), assert(external_trigger(rdf/3)), nl, write('ParsedEPQuery: '), write(ParsedEPQuery), nl, ep_sparql_compile(ParsedEPQuery,CEPRules,ResultComplexEvent), compile_internal_event_rules(main,CEPRules), nl, write('CEPRules: '), write(CEPRules), nl, nl, event(rdf(company1,hasStockPrice,1)), event(rdf(company1,hasStockPrice,2)), findall(stored_event(event(select_event([company1]),T)),stored_event(event(select_event([company1]),T)),List), (List=[stored_event(event(select_event([company1]),[datime(_,_,_,_,_,_,_),datime(_,_,_,_,_,_,_)]))] -> write(FH,'ep_sparql_01\t\t\tpassed\n'),write('ep_sparql_01\t\t\tpassed\n') ; write(FH,'ep_sparql_01\t\tfailed\n'),write('ep_sparql_01\t\tfailed\n') ),halt."

Darko Anicic

unread,
Feb 19, 2013, 8:17:47 AM2/19/13
to eta...@googlegroups.com
Hi Hendrik,

unfortunatelly getDURATION() has not been implemented. You can try to achieve the same with datime_minus_datime(T2,T1,T3) and t1(T1), t2(T2), as shown in the example:
etalis\examples\timestamp_01

Cheers, Darko
Reply all
Reply to author
Forward
0 new messages