Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

ASK content


Adding the ASK form of a SPARQL request can be performed with the ISparqlRequestGroup.addAsk() method.

Accessing the ASK form of a SPARQL request can be performed with the ISparqlRequestGroup.getAskForm() method.

For example:
   SparqlRequest request = new SparqlRequest("foaf");
   request.addAdditionalVariable("x");
   AskForm form = request.addAsk();
   form.addPropertyValue("x", "Name", "Alice");
   String sparql = request.getSPARQL();
Will have the following result:
   ASK {
      ?x foaf:Name "Alice" .
   }

If you add an ASK form, you will not have a WHERE form anymore.

Adding expressions in the ASK form

Adding expressions in the ASK form can be performed directly in the AskForm, or through the ISparqlRequestGroup.

For example, the following are equivalent:
   SparqlRequest request = new SparqlRequest("foaf");
   request.addAdditionalVariable("x");
   AskForm form = request.addAsk();
   form.addPropertyValue("x", "Name", "Alice");
   String sparql = request.getSPARQL();
or
   SparqlRequest request = new SparqlRequest("foaf");
   request.addAdditionalVariable("x");
   AskForm form = request.addAsk();
   request.addPropertyValue("x", "Name", "Alice");
   String sparql = request.getSPARQL();

See also


Categories: Requestcreation

Copyright 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help