Hi all,
I am working with Neo4j system and Sparql queries as a part of my thesis
and I am very very new these concepts. I have loaded the RDF dataset into
Neo4j and now trying to query the results. My problem is, only half of my
query is working and giving results but the query as a whole is not
returning any result. this is leaving me clueless and I have no idea why
this is happening..Kindly help me out with a solution.Thanks in advance!!
I have used the Sail interface for query parsing and evaluating
Here is the snippet:
Neo4jGraph neo = new Neo4jGraph("dataset");
Sail sail = new GraphSail(neo);
sail.initialize();
CommitManager manager =
TransactionalGraphHelper.createCommitManager(neo, 10000);
SailConnection sc= sail.getConnection();
Query1 ext=new Query1();
SPARQLParser parser = new SPARQLParser();
CloseableIteration<? extends BindingSet, QueryEvaluationException>
sparqlResults;
String queryString = "PREFIX bsbm:
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/> " +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
"SELECT DISTINCT ?product ?label " +
"WHERE { " +
" ?product rdf:type
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType2>
. " +
" ?product rdfs:label ?label . }";
/*"?product bsbm:productFeature
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature35>."
+
"?product bsbm:productFeature
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature36>
. " +
"?product bsbm:productPropertyNumeric1 ?value1 . " +
"FILTER (?value1 > 3) } " +
"ORDER BY ?label " +
"LIMIT 10";*/
try {
ParsedQuery query = parser.parseQuery(queryString,
"http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/");
System.out.println("\nSPARQL: " + queryString);
sparqlResults = sc.evaluate(query.getTupleExpr(), query.getDataset(),
new EmptyBindingSet(), false);
while (sparqlResults.hasNext()) {
System.out.println(sparqlResults.next());
}
IS IT ANY THING TO DO WITH INDEXING ??
P.S The commented portion of my query in the snippet is NOT working
cheers,
shri
--
View this message in context:
http://neo4j-community-discussions.438527.n3.nabble.com/problem-in-SPARQL-querying-tp3298204p3298204.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user