[英]Python rdflib and SPARQL BIND support
I am trying various SPARQL queries with BIND() function and neither seem to work with rdflib 4.0. 我正在尝试使用BIND()函数进行各种SPARQL查询,但似乎都不能与rdflib 4.0一起使用。
Each time I am getting: 每当我得到:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/.env/lib/python2.7/site-packages/rdflib/graph.py", line 1045, in query
query_object, initBindings, initNs, **kwargs))
File "~/.env/lib/python2.7/site-packages/rdfextras/sparql/processor.py", line 49, in query
loadContexts=loadContexts)
File "~/.env/lib/python2.7/site-packages/rdfextras/sparql/algebra.py", line 406, in TopEvaluate
assert isinstance(expr,AlgebraExpression), repr(expr)
edit Here's the query: 编辑这是查询:
CONSTRUCT { ?aspectA ?predicateURI ?aspectLabel. }
WHERE { ?aspectA aspects:A0060 ?aspectType;
aspects:A0101 ?aspectLabel.
BIND ( IRI( CONCAT("some.uri/raw/aspects#A";, ?aspectType) ) AS ?predicateURI ).
}
Any hints on what might be wrong? 有什么提示可能有问题吗?
I found where the problem came from. 我发现问题出在哪里。 I started the project with some old rdflib which required rdfextras.
我从需要rdfextras的旧rdflib开始了该项目。 They I upgraded rdflib to 4.0 (and eventually to 4.2-dev) where rdfextras are no longer necessary.
他们将rdflib升级到4.0(最终升级到4.2-dev),而不再需要rdfextras。 Actually, registering them was causing that problem.
实际上,注册它们会导致该问题。 Once I uninstalled rdfextras and removed plugin.register entries referencing them everything started to run smoothly.
一旦我卸载了rdfextras并删除了引用它们的plugin.register条目,一切就开始平稳运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.