다음과 같은 질문에 사용자가 대답해야하는 퀴즈 게임이 있습니다. 독일 수도 이름은 무엇입니까? 옵션은 다음과 같습니다 : Berlin Madrid London 데이터가 올빼미 파일에 있습니다.Java 변수를 사용하여 SPARQL 쿼리를 필터링하는 방법
저는 rdfs : rdfs와 같은 리소스 (퀴즈 질문 옵션)에 대한 의견을 가지고 있습니다. 베를린, 런던 등의 의견을 말합니다. 사용자가 잘못된 옵션 인 런던, rdfs : right 이 경우 베를린 사용자에게 옵션이 표시되어야합니다.
The right (correct) option I have is in java variable 'correct' and if user click wrong option, I want to show the rdfs:comment of correct option as:
"SELECT * " +
" WHERE { ?x rdfs:comment ?y " + "FILTER regex(?x ,'"+correct+"') " +
"}";
System.out.println(queryString);
Query query = QueryFactory.create(queryString);
QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
ResultSet results = qexec.execSelect() ;
while (results.hasNext())
{
QuerySolution binding = results.nextSolution();
Literal l=binding.getLiteral("y");
String s=l.toString();
The problem is that it does not show me the filtered value rdfs:comment. When I remove Filter, it shows all rdfs:comment of resources but with Filter value, it simply does not work.
When I print the query, it shows the options values but does not display the rdfs:comment of that resources.
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> prefix dbr: <http://dbpedia.org/page/>PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT * WHERE { ?x rdfs:comment ?y FILTER regex(?x ,"Berlin") }
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> prefix dbr: <http://dbpedia.org/page/>PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT * WHERE { ?x rdfs:comment ?y FILTER regex(?x ,"Rome") }
My owl for rdfs:comment is like: Berlin--> rdfs:comment
Rome--> rdfs:comment etc
같은 운동/프로젝트를 수행하는 대학의 학생 수는 몇 명입니까? 나는 당신이 이미 당신의 반의 누군가에 의해 예나 메일 링리스트에 물었다는 것을 확신합니다. – AKSW