private final String collectionsOntologyURI = "http://dblp.l3s.de/d2r/all/Collections";
private final String swrcOntologyURI = "http://swrc.ontoware.org/ontology";
private final String ontoAppOntologyURI = "http://www.nees.com.br/ontologies/2014/ontoApp";
public List<String> searchResearchersByName(String personName) {
Kao kaoPerson = new Kao(Agent.class, swrcOntologyURI);
String query = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+ "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n"
+ "PREFIX foaf:<http://xmlns.com/foaf/0.1/>\n"
+ "SELECT ?name\n"
+ "WHERE{?subject rdf:type foaf:Agent.\n"
+ " ?subject rdfs:label ?name.\n"
+ "FILTER regex(?name,'" + personName + "','i').\n"
+ "}";
List<? extends Object> researcher = null;
try {
researcher = (List<? extends Object>) kaoPerson.executeQueryAsSingleResult(query);
} catch (Exception e) {
researcher = null;
} finally {
kaoPerson.save();
return (List<String>) researcher;
}
}