[Solved] To write a query SPARQL in Java code using strstarts filter
I have resolved my problem using this code: public QueryExecution query(){ String stringa = “http://dbpedia.org/resource/Fred_Guy”; ParameterizedSparqlString qs = new ParameterizedSparqlString( “” + “prefix dbpediaont: <http://dbpedia.org/ontology/>\n” + “prefix dbpedia: <http://dbpedia.org/resource/>\n” + “prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n” + “\n” + “select ?resource where {\n” + “?mat rdf:type ?resource\n” + “filter strstarts(str(?resource), dbpediaont:)\n” + “}” ); Resource risorsa = ResourceFactory.createResource(stringa); … Read more