Skip to content

rdflib under python3 #617

Closed
Closed
@pfps

Description

@pfps

Is rdflib supposed to work in python3?

I´m getting one of the canonical non-compatability errors when I run its SPARQL implementation in python3.

Here is an edited version of what I am seeing, with some test printout included:

...
SORTING [((2, -4, True), (rdflib.term.Variable('this'), rdflib.term.URIRef('http://www.w3.org/ns/shacl#p1'), rdflib.term.Variable('value1'))), 
     ((2, -4, True), (rdflib.term.Variable('this'), Path(http://www.w3.org/ns/shacl#p2 / http://www.w3.org/ns/shacl#p2), rdflib.term.Variable('value1')))]
Traceback (most recent call last):
...
  File "/usr/lib/python3.4/site-packages/rdflib/graph.py", line 1084, in query
    query_object, initBindings, initNs, **kwargs))
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/processor.py", line 73, in query
    query = translateQuery(parsetree, base, initNs)
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 746, in translateQuery
    P, PV = translate(q[1])
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 535, in translate
    M = translateGroupGraphPattern(q.where)
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 295, in translateGroupGraphPattern
    G = Join(p1=G, p2=translateGroupOrUnionGraphPattern(p))
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 244, in translateGroupOrUnionGraphPattern
    g = translateGroupGraphPattern(g)
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 267, in translateGroupGraphPattern
    return ToMultiSet(translate(graphPattern)[0])
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 535, in translate
    M = translateGroupGraphPattern(q.where)
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 280, in translateGroupGraphPattern
    g[-1]["triples"] += triples(p.triples)
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 133, in triples
    for x in range(0, len(l), 3))
  File "/usr/lib/python3.4/site-packages/rdflib/plugins/sparql/algebra.py", line 115, in reorderTriples
    1], varsknown, varscount), x[1]) for x in l[i:])
TypeError: unorderable types: SequencePath() < URIRef()

The query includes SPARQL path expressions and these seem to be involved in
the comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SPARQLbugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions