I am new to all this and trying to build a simple example application. I want 
to arrange for my PC to display a special message-of-the-day banner on login if 
there are any pending "change freezes" for this system. To do this it will 
query the triplestore using LDPath to find the change freeze events that are 
associated with the machine as identified by its fqdn (in this case 
"pug.local").

I have marmotta set up and created two containers using LDP: one for Systems, 
including my PC, the other for change freeze events. Here are some examples:

A "System"...

@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix parent: <http://192.168.0.11:8080/marmotta/ldp/Systems/> .
@prefix child: <http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-2/> .
@prefix this: <http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-2#> .

parent:Pug-2 a ldp:Resource , ldp:RDFSource , ldp:Container , 
ldp:BasicContainer ;
        ldp:interactionModel ldp:Container ;
        dcterms:created "2015-07-21T22:36:30.000-07:00"^^xsd:dateTime ;
        dcterms:modified "2015-07-21T22:36:30.000-07:00"^^xsd:dateTime ;
        a <http://open-services.net/ns/crtv#ComputerSystem> ;
        <http://open-services.net/ns/crtv#fqdn> "pug.local" ;
        <http://open-services.net/ns/crtv#ipAddress> "192.168.0.11" .

Some "Freezes"

parent:8 a ldp:Resource , ldp:RDFSource , ldp:Container , ldp:BasicContainer ;
        ldp:interactionModel ldp:Container ;
        dcterms:created "2015-07-21T23:45:13.000-07:00"^^xsd:dateTime ;
        dcterms:modified "2015-07-21T23:45:13.000-07:00"^^xsd:dateTime ;
        a <http://www.w3.org/2002/12/cal/icaltzd#Vevent> ;
        <http://www.w3.org/2002/12/cal/icaltzd#class> "Freeze" ;
        rdf:about <http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-2> ;
        <http://www.w3.org/2002/12/cal/icaltzd#dtstart> 
"2015-07-28T20:00:00"^^<http://www.w3.org/2002/12/cal/tzd/America/Boise#tz> ;
        <http://www.w3.org/2002/12/cal/icaltzd#dtend> 
"2015-07-29T23:00:00"^^<http://www.w3.org/2002/12/cal/tzd/America/Boise#tz> .

And...

parent:9m a ldp:Resource , ldp:RDFSource , ldp:Container , ldp:BasicContainer ;
        ldp:interactionModel ldp:Container ;
        dcterms:created "2015-07-21T23:43:47.000-07:00"^^xsd:dateTime ;
        dcterms:modified "2015-07-21T23:43:47.000-07:00"^^xsd:dateTime ;
        a <http://www.w3.org/2002/12/cal/icaltzd#Vevent> ;
        <http://www.w3.org/2002/12/cal/icaltzd#class> "Freeze" ;
        rdf:about <http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-2> ;
        <http://www.w3.org/2002/12/cal/icaltzd#dtstart> 
"2015-07-25T23:00:00"^^<http://www.w3.org/2002/12/cal/tzd/America/Boise#tz> ;
        <http://www.w3.org/2002/12/cal/icaltzd#dtend> 
"2015-07-26T23:00:00"^^<http://www.w3.org/2002/12/cal/tzd/America/Boise#tz> .


All of these are separate resources (ie, they are not all in the same rdf file) 
though per default they are set up as separate LDPCs (I'm not sure if that 
matters).

I would like to make a single LDPath query that will return a list of all 
"Freezes" for a PC with a given fqdn.

My attempts at a queries have varied over the last few hours, but in general 
look like...

alanr@pug:~/apache-marmotta-tutorial-iswc2014/ldp$ curl -iX POST --data ' 
@prefix ldp: <http://www.w3.org/ns/ldp#> ; @prefix sys: 
<http://192.168.0.11:8080/marmotta/ldp/Systems/> ; @prefix crtv: 
<http://open-services.net/ns/crtv#> ; @prefix cal: 
<http://www.w3.org/2002/12/cal/icaltzd#> ; 
about=ldp:contains/rdf:about[crtv:fqdn is "pug.local"]  ; 
start=ldp:contains[rdf:about is sys:Pug-2]/(cal:dtstart) ;'  -H 'Content-Type: 
text/plain'  
http://192.168.0.11:8080/marmotta/ldpath/program?uri=http://192.168.0.11:8080/marmotta/ldp/Freezes


And the result I get is...

{"start":[{"value":"2015-07-21T23:00:00","datatype":"http://www.w3.org/2002/12/cal/tzd/America/Boise#tz","type":"literal"},{"value":"2015-07-25T23:00:00","datatype":"http://www.w3.org/2002/12/cal/tzd/America/Boise#tz","type":"literal"},{"value":"2015-07-28T20:00:00","datatype":"http://www.w3.org/2002/12/cal/tzd/America/Boise#tz","type":"literal"}],"about":[{"value":"http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-3","type":"uri"},{"value":"http://192.168.0.11:8080/marmotta/ldp/Systems/Pug-2","type":"uri"}]}

I'd like a single query to return all the freezes for a system specified by its 
fqdn in one shot (ie. if possible not have to query to collect the resources 
with that fqdn (eg sys:Pug-2) followed by a separate query to get the freezes 
that are rdf:about sys:Pug-2)

I have two questions...


1)      How can I select cal:dtstart and cal:dtend times for freezes belonging 
to the  freeze matching rdf:about[crtv:fqdn is "pug.local"]  ? I can see how I 
can select rdf:about, but not the other fields in the freeze record



2)      How can I group the results together ?  If I mess with it I can get a 
list of start times, a list of end times or even a big list of start and end 
times mixed together, but I can't figure a way to get a list of pairs of start 
and end times that go together, one for each "Freeze". Maybe I have just 
structured the data wrongly.


Thanks for your consideration

Alan

Reply via email to