简体   繁体   中英

Python rdflib and SPARQL BIND support

I am trying various SPARQL queries with BIND() function and neither seem to work with 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. They I upgraded rdflib to 4.0 (and eventually to 4.2-dev) where rdfextras are no longer necessary. Actually, registering them was causing that problem. Once I uninstalled rdfextras and removed plugin.register entries referencing them everything started to run smoothly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM