【发布时间】:2014-05-07 14:40:46
【问题描述】:
我对 Sparql 查询有一点问题。我想获取所有类型为“TopologicalNode”的主题,带有一个名为“BaseVoltage”的谓词和一个特定的资源(在本例中为“#_2a9”)
我的 .xml 有一个示例
<cim:TopologicalNode rdf:ID="_f4d">
<cim:IdentifiedObject.name>dj</cim:IdentifiedObject.name>
<cim:TopologicalNode.BaseVoltage rdf:resource="#_2a9"/>
</cim:TopologicalNode>
<cim:TopologicalNode rdf:ID="_738">
<cim:IdentifiedObject.name>iT</cim:IdentifiedObject.name>
<cim:TopologicalNode.BaseVoltage rdf:resource="#_a5c"/>
</cim:TopologicalNode>
<cim:TopologicalNode>
<cim:TopologicalNode rdf:ID="_2a2">
<cim:IdentifiedObject.name>Hi</cim:IdentifiedObject.name>
<cim:TopologicalNode.BaseVoltage rdf:resource="#_2a9"/>
<cim:TopologicalNode.ConnectivityNodeContainer rdf:resource="#_d7a"/>
</cim:TopologicalNode>
我的查询不起作用(遇到一个终止三重模式的令牌,但令牌太多而无法形成有效的三重模式)
"SELECT ?s WHERE {?s rdf:type cim:TopologicalNode; cim:TopologicalNode.BaseVoltage ?o rdf:resource '#_2a9';}"
我也尝试直接输入完整的 URI...同样的错误!
"SELECT ?s WHERE {?s rdf:type cim:TopologicalNode; cim:TopologicalNode.BaseVoltage ?o rdf:resource <example.org/EQ#_2a9>;}"
我的错误是什么?它必须在第三个街区,因为我看到这是有效的
"SELECT ?s WHERE {?s rdf:type cim:TopologicalNode; cim:TopologicalNode.BaseVoltage ?o }"
非常感谢!
【问题讨论】:
-
我对你的字符串中的引号数量感到困惑。您能否只显示 SPARQL 表达式,因为它们被发送到端点,而没有任何宿主语言引用或转义?
-
很抱歉我编辑了我的帖子。 query.CommandText 包含什么: SELECT ?s WHERE {?s rdf:type cim:TopologicalNode; cim:TopologicalNode.BaseVoltage ?o rdf:resource example.org/EQ#_2a9>}
-
提供完整的错误消息(可能包含行号和列号)以及堆栈跟踪会很有帮助。还有这是什么版本的dotNetRDF?
-
RDF 版本:1.0.3.0,运行时版本:v4.0.30319。错误在 uri 中,在 # 字符处。
标签: c# rdf sparql authorize.net-cim dotnetrdf