Sorry for the delay here - end of financial year work panic - I’ll look into 
this next week

— 
Dr Nicholas Car
Data Systems Architect
SURROUND Australia
0477 560 177
[email protected]

> On 9 Jun 2020, at 12:10 am, James Hudson <[email protected]> wrote:
> 
> 
> It appears that I was still using 4.2.2 of rdflib and the bug (whatever it 
> was) was fixed in 5.0.0 which I have upgraded to.
> 
>> On Mon, Jun 8, 2020 at 9:49 AM James Hudson <[email protected]> 
>> wrote:
>> I was hoping to get some quick attention on this as this appears to be a 
>> serious issue with RDFLib. If someone could confirm that I have found a bug, 
>> that would be helpful.
>> 
>> I submitted the bug report at https://github.com/RDFLib/rdflib/issues/1113
>> 
>> 
>> ```
>> import rdflib
>> from pprint import pprint
>> 
>> 
>> data = """
>> @prefix ex: <http://example.org/> .
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> 
>> 
>> ex:CCCC a rdfs:Class ;
>>     rdfs:subClassOf ex:AAAA .
>> 
>> 
>> ex:DDDD rdfs:subClassOf ex:BBBB,
>>         ex:AAAA .
>> """
>> 
>> 
>> g = rdflib.Graph().parse( data = data, format = 'ttl' )
>> 
>> 
>> # print( f"{g.serialize( format = 'ttl' ).decode( 'utf8' )}" )
>> 
>> 
>> query = """
>>         PREFIX sch:  <http://schema.org/>
>>         PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>>         PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>         
>>         SELECT ?class ?subclass
>>         WHERE {        
>>                 ?class rdfs:subClassOf+ ?subclass .                          
>>      
>>         }
>>         ORDER BY ?class ?subclass
>>         """
>> 
>> 
>> qres = g.query( query )
>> 
>> 
>> for row in qres:    
>>               
>>     aclass    = str( row['class'] )
>>     subclass  = str( row['subclass'] )
>>     print( f"{aclass:30s} {subclass:50s}" )  
>> ```
>> 
>> 
>> This outputs:
>> 
>> ```
>> http://example.org/CCCC        http://example.org/AAAA                       
>>     
>> http://example.org/CCCC        http://example.org/BBBB                       
>>     
>> http://example.org/DDDD        http://example.org/AAAA                       
>>     
>> http://example.org/DDDD        http://example.org/BBBB   
>> ```
>> 
>> 
>> The output declares there is a subClassOf path from CCCC to BBBB and there 
>> clearly is not. 
>> 
>> I downloaded a SPARQL playground from http://sparql-playground.sib.swiss 
>> which is trivial to get up and running on a local machine and tried the same 
>> data an query. The results were:
>> 
>> ```
>> <http://example.org/CCCC> <http://example.org/AAAA>
>> <http://example.org/DDDD> <http://example.org/AAAA>
>> <http://example.org/DDDD> <http://example.org/BBBB>
>> ```
>> 
>> 
>> which is *exactly* what one expects.
>> -- 
>> http://github.com/RDFLib
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "rdflib-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rdflib-dev/7dc69ed6-8607-492b-9f23-1797dc01264do%40googlegroups.com.
> 
> -- 
> http://github.com/RDFLib
> --- 
> You received this message because you are subscribed to the Google Groups 
> "rdflib-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rdflib-dev/CAEUVO9FKjWq_o3oQPiOkPZWTf%2Bcs_K201ZFcFwUjayg%2Bz8A39A%40mail.gmail.com.

-- 
http://github.com/RDFLib
--- 
You received this message because you are subscribed to the Google Groups 
"rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/562BA859-C962-4E28-BEDF-BDE4BC0EE099%40surroundaustralia.com.

Reply via email to