Hi abrante,
If I understood correctly your question, you want to know how to query
(using a SPARQL query) your RDF knowledge base server (hosted on some
remote machine) trough the SPARQL protocol from an XWiki page by the
push of a button or link and display the results on the same page.
There are 2 options:
1. Manually use the SPARQL protocol to send a HTTP request to your
server trough AJAX from the XWiki page.
2. Have(make) an XWiki plugin that uses some java library like Jena or
Sesame to make remote SPARQL queries and use it with Velocity from an
XWiki page.
For both cases, see the specification of the SPARQL protocol and how to
use it over HTTP (or SOAP):
http://www.w3.org/TR/rdf-sparql-protocol/#query-bindings-http
If you like Option 1, then you must:
1. Create a button or link and assign it an ID.
2. Create a div or some sort of container for the result and assign it
an ID as well.
3. Add a JavaScriptExtension (JSX) object to your xwiki page and observe
the click event (
http://www.prototypejs.org/api/element/methods/observe
) of the element with the ID you just assigned at step 1 (your link/button).
4. Implement the JS event handler to issue an Ajax request (
http://www.prototypejs.org/learn/introduction-to-ajax ) with your
hand-crafted query to your SPARQL (RDF) server.
4'. Implement the JS callback method that takes the result of the Ajax
request, processes it and then dump it into your HTML container that you
created at step 2 in order to show the result to the user.
Here is a sample HTTP query (that works from your browser):
http://www4.wiwiss.fu-berlin.de/is-group/sparql?query=SELECT * WHERE {?s
?o ?p} LIMIT 10
Encoded version looks like this:
http://www4.wiwiss.fu-berlin.de/is-group/sparql?query=SELECT%20*%20WHERE%20…
I hope I did not assume too much :)
Good luck,
Eduard
On 08/17/2010 10:38 AM, abrante wrote:
I am trying to run a query from one xwiki page but I
could not, someone
please can sent me some code example? I want that the user only do click in
the link and the report must appear.
My query is the follow and I am working with velocity for the scripts
Thanks in advance :)
"SELECT DISTINCT ?property ?hasValue ?isValueOf
WHERE {
{
<http://testforge.int-evry.fr/d2r-server/resource/bugsubmitters/6688a14521cd97db162af8f9757f2e2232300e50>
?property ?hasValue
}
UNION
{ ?isValueOf ?property
<http://testforge.int-evry.fr/d2r-server/resource/bugsubmitters/6688a14521cd97db162af8f9757f2e2232300e50>
}
}
ORDER BY (!BOUND(?hasValue)) ?property ?hasValue ?isValueOf "