Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to eliminate empty resultsets in SPARQL?
    text
    copied!<p>I am doing a project under Semantic Web.This is an example of RDF file i am using</p> <blockquote> <pre><code>&lt;?xml version="1.0"?&gt; &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://www.xmlns.com/foaf/0.1"&gt; &lt;rdf:Description&gt; &lt;foaf:name&gt;aricent&lt;/foaf:name&gt; &lt;foaf:url&gt;www.placementhub.net&lt;/foaf:url&gt; &lt;/rdf:Description&gt; &lt;/rdf:RDF&gt; </code></pre> </blockquote> <p>if user enters "prepare for aricent" for searching the link,I coded in a way to take each value "prepare","for","aricent" and dynamically generate SPARQL query to find the related record.This is the SPARQL query</p> <blockquote> <p>String queryString ="PREFIX rdf: <a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rel="nofollow">http://www.w3.org/1999/02/22-rdf-syntax-ns#</a> " + "PREFIX foaf: <a href="http://www.xmlns.com/foaf/0.1" rel="nofollow">http://www.xmlns.com/foaf/0.1</a> " + "SELECT ?name ?url WHERE { ?a foaf:name ?name FILTER regex(?name,'"+ values[i]+"') ?a foaf:url ?url }";</p> </blockquote> <p>where values[i] is now " prepare" in 1st loop,"for" in 2nd loop and "aricent" in 3rd loop. In such a case if it is executed i will get as</p> <pre><code>-------------------------------------- | name | url | ====================================== | | | -------------------------------------- -------------------------------------- | name | url | ====================================== | | | -------------------------------------- -------------------------------------- | name | url | ====================================== | "aricent" | "www.placementhub.net" | -------------------------------------- </code></pre> <p>So the resultset is empty(with no values) for "prepare" and "for" and result is got only for "aricent" as it is available in RDF.Can you please tel me how to eliminate(only the table that has value should be shown to the user) the empty resultsets obtained?i used JENA API's.Thank You</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload