Letractively / rdflib

Automatically exported from code.google.com/p/rdflib
Other
0 stars 0 forks source link

Sparql language comparison doesn't matc '' to None #83

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add triple ?abc with no language
2. Sparql query: FILTER (lang(?abc) = '')

What is the expected output? What do you see instead?
Expected: Match
Actual: No Match

What version of the product are you using? On what operating system?
2.4.1

Please provide any additional information below.
All triples without a language have a defualt of None.  I would expect an
empty quote to match a None language.  So I can say:

FILTER (lang(?abc) = 'en-gb' || lang(?abc) = '')

Fix:

--- ./rdflib/sparql/sparqlOperators.py
+++ ./rdflib/sparql/sparqlOperators.py
@@ -313,7 +313,7 @@
         if v == None: return ""
         try :
             val = bindings[v]
-            if val == None:
+            if val == None or val.language == None:
                 return ""
             else :
                 return val.language

Original issue reported on code.google.com by jus...@onebrightspace.com on 1 Sep 2009 at 9:44

GoogleCodeExporter commented 9 years ago

Original comment by eik...@gmail.com on 1 Feb 2010 at 7:41

GoogleCodeExporter commented 9 years ago

Original comment by eik...@gmail.com on 1 Feb 2010 at 8:04

GoogleCodeExporter commented 9 years ago
These issues involve bits that have been moved out of rdflib proper for now. We 
will re-open them 
or move them to rdfextas as appropriate.

Original comment by eik...@gmail.com on 11 Feb 2010 at 6:06