Excluding Blank Nodes from SPARQL query results

后端 未结 1 638
醉话见心
醉话见心 2021-02-09 05:23

I am using RDFLib to query on the Semantic Dicom Ontology. I am querying for owl:Class in the graph constructed from the above ontology. RDFLib returns results which contain bla

相关标签:
1条回答
  • 2021-02-09 05:53
    from rdflib import Graph
    g = Graph()
    g.parse('dicom.owl')
    q = """SELECT ?c WHERE { ?c rdf:type owl:Class .
           FILTER (!isBlank(?c)) }"""
    qres = g.query(q)
    

    Take a look at this family of SPARQL functions:

    • isIRI,
    • isBlank,
    • isLiteral, isNumeric.
    0 讨论(0)
提交回复
热议问题