You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@marmotta.apache.org by Joshua Dunham <jo...@vrtx.com> on 2014/07/21 23:54:55 UTC
LDPath Query via curl - examples
Hi Marmotta-Users,
Sorry for the newbie question … I crawled through the old mailing lists but haven’t been able to put this together. How do I query the LDPath data both via a path and program?
Let’s say,
My server is : http://server.com/marmotta
My input context is : http://server.com/marmotta/context/people
My LDPath program is :
---------
@prefix foaf : <http://xmlns.com/foaf/0.1/> ;
friends = foaf:knows / (foaf:name | fn:concat(foaf:givename," ",foaf:surname)) :: xsd:string;
---------
Am I correct in reading that I can save this program to marmotta and run it as I wish by referencing it (like a function)?
How would I also run it via curl call by attaching it as the message via POST/GET or inline string?
Wishlist: It would be great if in the various web service interfaces api pages to the data (Sparql, LDPath, Security), marmotta could actually give the full resource name. The _SERVER_URI_ is known as is the base path. If it showed full examples that were expanded with references to either default context or the first non-standard one that would Greatly help. :)
Sorry for pestering and thank you in advance!
-Joshua
Joshua Dunham
Scientific Computing | Vertex
E: joshua_dunham@vrtx.com
P: 617-229-5157
W: http://www.vrtx.com
L: http://linkedin.com/in/joshuadunham
S: joshua.dunham
This email message and any attachments are confidential and intended for use by the addressee(s) only. If you are not the intended recipient, please notify me immediately by replying to this message, and destroy all copies of this message and any attachments. Thank you.
Re: LDPath Query via curl - examples
Posted by Sergio Fernández <wi...@apache.org>.
Hi Joshua,
On 21/07/14 23:54, Joshua Dunham wrote:
> Sorry for the newbie question … I crawled through the old mailing
> lists but haven’t been able to put this together. How do I query the
> LDPath data both via a path and program?
>
> Let’s say, My server is : http://server.com/marmotta
> My input context is : http://server.com/marmotta/context/people
> My LDPath program is :
> ---------
> @prefix foaf : <http://xmlns.com/foaf/0.1/> ;
> friends = foaf:knows / (foaf:name | fn:concat(foaf:givename,"
> ",foaf:surname)) :: xsd:string;
> ---------
Well, first notice that LDPath is a resource-centered language; i.e.,
you have to start to navigate from a resource, a context.
There is a terminology issue with that meaning of "context" and how
context is used in the triplestore, which is Sesame terminology. So do
not be confused. Read some background at the following thread:
http://markmail.org/message/ejmps73h5rhoxxng
> Am I correct in reading that I can save this program to marmotta and
> run it as I wish by referencing it (like a function)?
No, that's a feature of lmf-search, which provides LDPath programs
storing to configure search cores.
The LDPath Query interface provides you a UI for evaluating programs.
Just that.
> How would I also run it via curl call by attaching it as the message
> via POST/GET or inline string?
As you can find in the web serviuce tag, the call is:
GET /ldpath/program?program=...&uri=...
So the CURL call would look like (query parameters must be URL-encoded):
$ curl
'http://localhost:8080/ldpath/program?uri=http%3A%2F%2Fexample.org%2Fresource&program=%40prefix%20foaf%20%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%20%3B%0Afriends%20%20%20%20%3D%20foaf%3Aknows%20%2F%20(foaf%3Aname%20%7C%20fn%3Aconcat(foaf%3Agivename%2C%22%20%22%2Cfoaf%3Asurname))%20%3A%3A%20xsd%3Astring%3B'
> Wishlist: It would be great if in the various web service interfaces
> api pages to the data (Sparql, LDPath, Security), marmotta could
> actually give the full resource name. The _SERVER_URI_ is known as is
> the base path. If it showed full examples that were expanded with
> references to either default context or the first non-standard one
> that would Greatly help. :)
Sorry, web services documentations is generating at compilation time
using JAX-RS Doclet. Therefore it is not possible to know in advance in
which base URL the server will be running, giving the actual full
resource URI.
Please, file a jira witht eh feature request. If you have a proposal
about a better documentation mechanism, or a patch to the current want
to use the _SERVER_URI_ in runtime, it would be very welcomed.
Cheers,
--
Sergio Fernández
Senior Researcher
Knowledge and Media Technologies
Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43 662 2288 318 | M: +43 660 2747 925
sergio.fernandez@salzburgresearch.at
http://www.salzburgresearch.at
--
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 660 2747 925
e: sergio.fernandez@redlink.co
w: http://redlink.co