Querying letter mu in Sparql

2019-07-28 22:41发布

问题:

I am using python library RDFLIB to query on semantic dicom owl file. I need to query for a label containing letter mu. I am not able to figure out how to query for labels containing this letter. The code is given below -

q = """SELECT ?ur WHERE{?ur rdfs:label "Exposure in uAs".}"""
qres = g.query(q)
for row in qres:
    print(row)

I am not getting any results for the above query.

The semantic dicom owl files contain the following triples -
Image of what I am trying to search contents of sedi file (<10 reputation, can't post images)

SEDI file - Semantic Dicom OWL file

回答1:

This is not the greek letter μ (U+03BC), but the micro sign (U+00B5).

The following code works for me in Python 3.6:

q = """SELECT ?ur WHERE{?ur rdfs:label "Exposure in µAs".}"""
qres = g.query(q)
for row in qres:
    print(row)

The following code works for me both in Python 2.7 and Python 3.6:

q = """SELECT ?ur WHERE{?ur rdfs:label "Exposure in \u00b5As".}"""
qres = g.query(q)
for row in qres:
    print(row)