简体   繁体   中英

SPARQL QUERY OWL FILE

Could I ask you about a SPARQL query on an Ontology. I have a family.owl file is the ontology build from protege 3.4 with data:

Lan haschild Tuấn, 
Tùng haschild Tuấn.

I use Java and CORESE API on site (http://www-sop.inria.fr/edelweiss/software/corese/v2_4_0/manual/index.php#coreseapi ) to query the family.owl above. With the following SPARQL query:

PREFIX fm:< http://www.owl-ontologies.com/Ontology1287989576.owl#>

SELECT ?child
WHERE 
{ 
  fm:Lan fm:haschild ?child 
} 

The result is Tuấn (true result must be Tuấn)

If I replace "where" clause as: WHERE { fm:Tùng fm:haschild ?child } then the result is empty (true result must be Tuấn)

I know the wrong result at string "Tùng" and "Tuấn". This string has character unicode ù, ấ

Can you have me using unicode character in CORESE API to query owl file with sparql.

A possible solution is to escape the URIs so instead of:

fm:Tùng --> fm:T%C3%B9ng

and

fm:Tuấn --> fm:Tu%E1%BA%A5n

If you create the data in this way you should not have problems. It's not very advisable to have accents in the URIS so people tend to encode/escape URIs for that reason, and most languages have libraries to encode URIs. For instance in Python is as easy as ...

>>> import urllib
>>> urllib.quote("Tùng")
'T%C3%B9ng'
>>> urllib.quote("Tuấn")
'Tu%E1%BA%A5n'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM