I am doing a project under Semantic Web.This is an example of RDF file i am using
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://www.xmlns.com/foaf/0.1"> <rdf:Description> <foaf:name>aricent</foaf:name> <foaf:url>www.placementhub.net</foaf:url> </rdf:Description> </rdf:RDF>
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
String queryString ="PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# " + "PREFIX foaf: http://www.xmlns.com/foaf/0.1 " + "SELECT ?name ?url WHERE { ?a foaf:name ?name FILTER regex(?name,'"+ values[i]+"') ?a foaf:url ?url }";
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
--------------------------------------
| name | url |
======================================
| | |
--------------------------------------
--------------------------------------
| name | url |
======================================
| | |
--------------------------------------
--------------------------------------
| name | url |
======================================
| "aricent" | "www.placementhub.net" |
--------------------------------------
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