Closed scharrenbach closed 10 years ago
i just tried to reproduce this but everything seems to work for me:
In [18]: print_results(g, query)
- - - - - - - - - - - - - - -
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Buzzwords'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Service100577525'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Nonsense106607339'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thing'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Communication100033020'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/PsychologicalFeature100023100'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/ontology/TopicalConcept'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Message106598915'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Work100575741'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/YagoPermanentlyLocatedEntity'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Act100030358'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Buzzword106608277'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/WebServices'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Event100029378'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/ontology/Genre'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/ontology/MusicGenre'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Abstraction100002137'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
(rdflib.term.URIRef(u'http://dbpedia.org/class/yago/Activity100407535'), rdflib.term.URIRef(u'http://dbpedia.org/resource/Semantic_Web'))
- - - - - - - - - - - - - - -
also i get the same results for a
or rdf:type
...
@scharrenbach can you try again? maybe the DBpedia endpoint was down? also there's a MyGraph
in your snippet which i don't see any use for, could you retry the following simplistic snippet:
from rdflib import Graph, URIRef
from rdflib.namespace import RDF
subject = URIRef('http://example.com/test/')
my_type = URIRef('http://example.com/ontology/MyType')
g = Graph()
g.add((subject, URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), my_type))
print list(g.query('select * where { ?s a ?o }'))
this returns
[(rdflib.term.URIRef(u'http://example.com/ontology/MyType'), rdflib.term.URIRef(u'http://example.com/test/'))]
for me
After two clean re-installs and testing it in several environments (both Python 2.7 and 3.4), I was no longer able to reproduce the error. Sorry for the trouble. However, what puzzled me was that queries worked for every predicate except rdf:type.
I finally found the issue. It seems that I was calling the code accidentally including a module which defines the extension point for BGP matching. Works like a charm and the problem was rather located between my ears :-)
;) no worries, happens to all of us
Affected version 4.1.2
When loading data or adding data manually, querying for rdf:type returns no results. It does not matter whether data was added from a URL resource or manually.
When querying for a variable subject or iterating over the graph, the statements with a predicate of rdf:type are returned correctly.