views:

21

answers:

2

Hi everybody,

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#&gt;

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.

+1  A: 

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'
msalvadores
A: 

Hello msalvadores, I did like you said but the result still wrong. I put the file name QueryOWL.rar on http://www.mediafire.com/file/spp8eo8vd2rolxx/QueryOWL.rar . In this file, I run F1.java by Jcreator IDE v4.5.

On the interface, First press "Load File" button to load the family.owl file and then Press "Query" button to query from owl file. But the result display incorrect: Tuấn (true result must be Tuấn).

I tried to set encoding to UTF8 but not successful. Could you help me check this problem. Thank you very much, look forward to help from you.

Nguyen