В настоящее время я создаю музыкальную систему рекомендаций. На первом этапе я хочу создать персональный профиль пользователя, используя FOAF (друг друга), но при использовании SPARQL я не могу получить foaf: интерес файла - профиль пользователя.Получить foaf: интерес к профилю пользователя
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:admin="http://webns.net/mvcb/">
<foaf:PersonalProfileDocument rdf:about="">
<foaf:maker rdf:resource="#me"/>
<foaf:primaryTopic rdf:resource="#me"/>
<admin:generatorAgent rdf:resource="http://www.ldodds.com/foaf/foaf-a-matic"/>
<admin:errorReportsTo rdf:resource="mailto:[email protected]"/>
</foaf:PersonalProfileDocument>
<foaf:Person rdf:ID="me">
<foaf:name>Pham Hai</foaf:name>
<foaf:title>Mr</foaf:title>
<foaf:givenname>Pham</foaf:givenname>
<foaf:family_name>Hai</foaf:family_name>
<foaf:nick>HaiLeader</foaf:nick>
<foaf:mbox_sha1sum>c900f594220ceebb386c02ad2e157cef0fb397b2</foaf:mbox_sha1sum>
<foaf:homepage rdf:resource="http://facebook.com.vn"/>
<foaf:depiction rdf:resource="http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2016_03_17/hg/anh-noi-y-giuong-chieu-nong-bong-cua-hot-girl-sai-thanh.jpg"/>
<foaf:phone rdf:resource="tel:0962354550"/>
<foaf:interest rdf:resource="http://www.w3.org/2001/sw/"/>
</foaf:Person>
Это мой запрос.
Model model = FileManager.get().loadModel(FILE_NAME);
showLogAndToast(model.toString());
String queryString =
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
"SELECT * WHERE { " +
" ?p foaf:interest ?interest ." +
"}";
Query query = QueryFactory.create(queryString);
QueryExecution qexec = QueryExecutionFactory.create(query, model);
try {
ResultSet results = qexec.execSelect();
while (results.hasNext()){
QuerySolution solution = results.nextSolution();
showLogAndToast(solution.toString());
//Literal name = solution.getLiteral("interest");
//showLogAndToast(name.getString());
}
} finally {
qexec.close();
}
EDIT Я исправлены ошибки. До этого я ошибся в запросе SPARQL. Большое спасибо.
Какие API вы используете? Какой запрос SPARQL не работает? Пожалуйста, покажите запрос. – AKSW
Спасибо, что ответили. Затем я обновил свой запрос. –
Итак, вы решили свою проблему? Будет ли решение полезным для кого-то другого, или это не проблема с вашим запросом (как указано здесь)? – unor