This may be way off base…

I wrote a small java EE application that accepts a get request with parameters, 
it then searches for an RDF record in LDP that matches the name of the query, 
validates the parameters according to the instructions it finds in the RDF, 
formulates a SPARQL query then returns the results/errors.

Here’s an example record representing an allowable query – I just made up the 
vocabulary…

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dlq: <http://unfortunate.name/2015/query#> .

<> a dlq:sparqlQuery;
    rdfs:label "Returns a list of names of individuals who have attained the 
age of majority and hence are considered to be adults.";
    dlq:param [ dlq:paramName "majority"; dlq:dataType dlq:unsignedInt; 
dlq:maxValue "150"; dlq:defaultValue "18"; rdfs:label "age of majority" ];
    dlq:sparql "PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name  WHERE 
{?i a foaf:Person . ?i foaf:name ?name . ?i foaf:age ?age . FILTER (?age >= 
majority)}"; .

I post the above ttl file to marmotta so that it can be found via LDP at:

http://ldp:8080/marmotta/ldp/QUERIES/findAdults<%0bhttp:/ldp:8080/marmotta/ldp/QUERIES/findAdults>

My SPARQL proxy sits on tomcat alongside marmotta and when it gets a query like:

http://ldp:8080/proxy/Services/findAdults?majority=21

It looks up the above record in LDP by appending findAdults to the path, then 
it validates the “majority” parameter and builds a SPARQL query, substituting 
in the parameter where it is named then executes it and returns the result (or 
of course an error message if anything is out of kilter)

I also went ahead and added a few dummy records with people of various ages so 
that the SPARQL query had something to work with.

Right now it only supports simple validations like integer ranges, but it could 
be extended to other types.

I built it because while don’t mind users having SPARQL access in my dev 
environment, I want only canned queries in my production environment because I 
have seen how unfettered queries can bog down other databases. I was not so 
worried about security as performance.

The only interfaces between marmotta and the query proxy are marmotta’s 
standard REST APIs, so the proxy need not be hosted on the same machine as 
marmotta.

Is this along the lines of what you wanted ?

Alan
From: Rob Atkinson [mailto:r...@metalinkage.com.au]
Sent: Monday, February 15, 2016 4:55 AM
To: users@marmotta.apache.org
Subject: Support for RDF-shapes, Linked data API

Hi

I am looking at linked data applications to add value to data exposed via Web 
Services, to add the missing semantics about the exposed content needed to 
actually discover and use those services.
i need to be able to traverse graphs composed of things like VoiD, RDF-Datacube 
etc.
The RDF-shapes scope covers this, and there are some elements of Marmotta such 
as LDPath that are relevant. I've previously built the functionality I needed 
using the LinkedDataAPI 
(https://github.com/UKGovLD/linked-data-api<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_UKGovLD_linked-2Ddata-2Dapi&d=BQMFaQ&c=jcv3orpCsv7C4ly8-ubDob57ycZ4jvhoYZNDBA06fPk&r=xN9AnMDZvO_QvUZQZcoply6WFqSJuNcpv-dDu2fA4Ac&m=sJnASXMUIR0ucnEHlcG3kM1GZ5TFHlhGyAhkYT45qfY&s=StoV4m3FfnN5m7Y1JgL1aSFxde0mEhsWqxXB6i_H-FA&e=>).
Is there anything in Marmotta to support parameterised SPARQL queries accessed 
via URL based APIs, and building a response by traversing paths from the query 
results?  (i've looked but not found anything - any pointers to descriptions of 
the marnotta core would be helpful!)

Regards
Rob Atkinson

Reply via email to