开发者

Whats wrong with this SPARQL query?

开发者 https://www.devze.com 2023-01-28 20:06 出处:网络
String sparql = \"\"; sparql+= \"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\\n\"; sparql+= \"PREFIX i: <http://evolizer.org/ontologies/seon/2010/09/softwaremetrics.owl#>\\n\";
String sparql = "";
            sparql+= "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n";
            sparql+= "PREFIX i: <http://evolizer.org/ontologies/seon/2010/09/softwaremetrics.owl#>\n";
            sparql+= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n";
            sparql+="SELECT ?metric ?value\n";
            sparql+="WHERE {\n";
            sparql+="?metric rdf:type i:SoftwareDesignMetric .\n";
            sparql+="?metric i:hasName McCabe .\n";
            sparql+= "?metric i:hasValue ?value \n";
            sparql+="}\n";

By executing i get this exception:

A first chance exception of type 'System.Net.WebException' occurred in System.dll
exception when sending query: 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-s开发者_JAVA百科chema#>
PREFIX i: <http://evolizer.org/ontologies/seon/2010/09/softwaremetrics.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?metric ?value
WHERE {
?metric rdf:type i:SoftwareDesignMetric .
?metric i:hasName McCabe .
?metric i:hasValue ?value 
}

The problem has to be the query itself, because other queries to the same server are working.


All of the examples here place the string arguments (such as McCabe in your example) in quotes. Could this be it?


I also found a validator that gives hint on what is wrong with a query:

http://sparql.org/query-validator.html

0

精彩评论

暂无评论...
验证码 换一张
取 消