-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

I have some problems with querying for unicode literals. If I have a query like:

select ?x where { ?x ?y ?z FILTER ( ?z == "ö" ). }

I get exceptions when parsing. This only breaks when in a filter though.

I attach a "test-case"

I see unicode and sparql used to be a problem way back:
http://rdflib.net/issues/2006/11/14/another_problem_with_unicode_strings_in_sparql_queries/issue
and
http://rdflib.net/issues/2006/11/01/unicode_strings_in_sparql_query_is_not_supported/issue

but it was apparently fixed.

- --
Gunnar Aastrand Grimnes
gunnar.grimnes [AT] dfki.de

DFKI GmbH
Knowledge Management
Trippstadter Strasse 122
D-67663 Kaiserslautern
Germany

Office: +49 631 205 75-117
Mobile: +49 177 277 4397


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGnLOYfD15aMgAOfcRAimbAJ4r1OHR76TQCwLRy0tjnCANkRLTdQCeOo3q
KnzTsniFjuXQrIG1YkVrxGE=
=2bAm
-----END PGP SIGNATURE-----
#!/usr/bin/env python

import traceback

import rdflib

# the real unicode
q=u"SELECT ?x where { ?x ?y ?z FILTER (?y = '\xf6')}"

# utf8 str
utf8q=q.encode("utf-8")

# q2
q2=u"SELECT ?x where { ?x ?y '\xf6' }"

utf8q2=q2.encode("utf-8")

# now: type(utf8q) == str

g=rdflib.Graph()

try:
    print "Q1: unicode"
    g.query(q)
    print "OK!"
except:
    traceback.print_exc()


try:
    print "Q1: utf8"
    g.query(utf8q)
    print "OK"
except:
    traceback.print_exc()


try:
    print "Q2: unicode"
    g.query(q2)
    print "OK"
except:
    traceback.print_exc()


try:
    print "Q2: utf-8"
    g.query(utf8q2)
    print "OK"
except:
    traceback.print_exc()

_______________________________________________
Dev mailing list
Dev@rdflib.net
http://rdflib.net/mailman/listinfo/dev

Reply via email to