这个 SPARQL 查询有什么问题?
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";
通过执行我得到这个异常:
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-schema#>
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
}
问题必须是查询本身,因为对同一服务器的其他查询正在工作。
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-schema#>
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所有示例此处都放置字符串参数(例如示例中的 McCabe)用引号引起来。会是这样吗?
All of the examples here place the string arguments (such as McCabe in your example) in quotes. Could this be it?
我还找到了一个验证器,它提示查询有什么问题:
http://sparql.org/query -validator.html
I also found a validator that gives hint on what is wrong with a query:
http://sparql.org/query-validator.html