can't output chinese .owl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

can't output chinese .owl

chuang grace
Hi!Everybody..
I have a program is output .owl, but chinese word can't implement.
my code is
import edu.stanford.smi.protegex.owl.jena.*;
import edu.stanford.smi.protegex.owl.model.*;
import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
import edu.stanford.smi.protegex.owl.*;
import java.util.*;
import edu.stanford.smi.protege.plugin.*;
import java.net.*;
import java.io.*;
import java.lang.*;
import sun.misc.*
import java.awt.*;
 
public class owl5 {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
 
  JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
     OWLNamedClass personClass = owlModel.createOWLNamedClass("人");
     OWLDatatypeProperty ageProperty = owlModel.createOWLDatatypeProperty("年紀");
     ageProperty.setRange(owlModel.getXSDint());
     ageProperty.setDomain(personClass);
     OWLIndividual individual = personClass.createOWLIndividual("Holger");
     individual.setPropertyValue(ageProperty, new Integer(33));
     Jena.dumpRDF(owlModel.getOntModel());
     owlModel.getOWLDLOntModel().write(System.out);
    // Jena.getOWLSpeciesString(owlModel.getOntModel());
 }
}
result:
<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="http://www.owl-ontologies.com/unnamed.owl#"
  xml:base="http://www.owl-ontologies.com/unnamed.owl">
  <owl:Ontology rdf:about=""/>
  <owl:Class rdf:ID="鈭�"/>
  <owl:DatatypeProperty rdf:ID="撟渡��">
    <rdfs:domain rdf:resource="#鈭�"/>
    <rdfs:range rdf:resource="<A href='http://www.w3.org/2001/XMLSchema#int"/'>http://www.w3.org/2001/XMLSchema#int"/>
  </owl:DatatypeProperty>
  <鈭� rdf:ID="Holger">
    <撟渡�� rdf:datatype="<A href='http://www.w3.org/2001/XMLSchema#int">33http://www.w3.org/2001/XMLSchema#int">33</撟渡��>
  </鈭�>
</rdf:RDF>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="http://www.owl-ontologies.com/unnamed.owl#" >
  <rdf:Description rdf:about="http://www.owl-ontologies.com/unnamed.owl">
    <rdf:type rdf:resource="<A href='http://www.w3.org/2002/07/owl#Ontology"/'>http://www.w3.org/2002/07/owl#Ontology"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://www.owl-ontologies.com/unnamed.owl#撟渡��">
    <rdf:type rdf:resource="<A href='http://www.w3.org/2002/07/owl#DatatypeProperty"/'>http://www.w3.org/2002/07/owl#DatatypeProperty"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://www.owl-ontologies.com/unnamed.owl#鈭�">
    <rdf:type rdf:resource="<A href='http://www.w3.org/2002/07/owl#Class"/'>http://www.w3.org/2002/07/owl#Class"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://www.owl-ontologies.com/unnamed.owl#Holger">
    <rdf:type rdf:resource="http://www.owl-ontologies.com/unnamed.owl#鈭�"/>
  </rdf:Description>
</rdf:RDF>
Thanks!

___________________________________________________ 最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打! http://messenger.yahoo.com.tw/

Reply | Threaded
Open this post in threaded view
|

Re: can't output chinese .owl

Hai Wang
Hi Grace,

I never tried, but this could be the problem.
The default encode for the XML file generate by Jena  is UTF-8, which  
support chinese. Please try to write to  an OutputStream and not a  
Writer because Jena will carefully choose the output charset but if  
the Writer already has an encoding, it can't and it will be wrong.  
Do not use Java FileWriter.

Regards
Hai


On 26 Apr 2006, at 02:00, chuang grace wrote:

> Hi!Everybody..
> I have a program is output .owl, but chinese word can't implement.
> my code is
> import edu.stanford.smi.protegex.owl.jena.*;
> import edu.stanford.smi.protegex.owl.model.*;
> import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
> import edu.stanford.smi.protegex.owl.*;
> import java.util.*;
> import edu.stanford.smi.protege.plugin.*;
> import java.net.*;
> import java.io.*;
> import java.lang.*;
> import sun.misc.*
> import java.awt.*;
>
> public class owl5 {
>  /**
>   * @param args
>   */
>  public static void main(String[] args) {
>   // TODO Auto-generated method stub
>
>
>   JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
>      OWLNamedClass personClass = owlModel.createOWLNamedClass("人");
>      OWLDatatypeProperty ageProperty =  
> owlModel.createOWLDatatypeProperty("年紀");
>      ageProperty.setRange(owlModel.getXSDint());
>      ageProperty.setDomain(personClass);
>      OWLIndividual individual = personClass.createOWLIndividual
> ("Holger");
>      individual.setPropertyValue(ageProperty, new Integer(33));
>      Jena.dumpRDF(owlModel.getOntModel());
>      owlModel.getOWLDLOntModel().write(System.out);
>     // Jena.getOWLSpeciesString(owlModel.getOntModel());
>  }
> }
> result:
> <?xml version="1.0"?>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>     xmlns="http://www.owl-ontologies.com/unnamed.owl#"
>   xml:base="http://www.owl-ontologies.com/unnamed.owl">
>   <owl:Ontology rdf:about=""/>
>   <owl:Class rdf:ID="鈭�"/>
>   <owl:DatatypeProperty rdf:ID="撟渡��">
>     <rdfs:domain rdf:resource="#鈭�"/>
>     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
>   </owl:DatatypeProperty>
>   <鈭� rdf:ID="Holger">
>     <撟渡�� rdf:datatype="http://www.w3.org/2001/ 
> XMLSchema#int">33</撟渡��>
>   </鈭�>
> </rdf:RDF>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>     xmlns="http://www.owl-ontologies.com/unnamed.owl#" >
>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
> unnamed.owl">
>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
>   </rdf:Description>
>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
> unnamed.owl#撟渡��">
>     <rdf:type rdf:resource="http://www.w3.org/2002/07/ 
> owl#DatatypeProperty"/>
>   </rdf:Description>
>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
> unnamed.owl#鈭�">
>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
>   </rdf:Description>
>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
> unnamed.owl#Holger">
>     <rdf:type rdf:resource="http://www.owl-ontologies.com/ 
> unnamed.owl#鈭�"/>
>   </rdf:Description>
> </rdf:RDF>
> Thanks!
> ___________________________________________________ 最新版  
> Yahoo!奇摩即時通訊 7.0,免費網路電話任你打! http://
> messenger.yahoo.com.tw/

Regards
Hai


Research Associate
Department of Computer Science
Kilburn Building
University of Manchester
Oxford Road
Manchester M13 9PL
UK
Homepage: http://www.cs.man.ac.uk/~hwang



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: can't output chinese .owl

k6509090
Thank you so much .
I resolve it.
----- Original Message -----
From: "Hai Wang" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, April 26, 2006 4:33 PM
Subject: [protege-owl] Re: can't output chinese .owl


> Hi Grace,
>
> I never tried, but this could be the problem.
> The default encode for the XML file generate by Jena  is UTF-8, which
> support chinese. Please try to write to  an OutputStream and not a  Writer
> because Jena will carefully choose the output charset but if  the Writer
> already has an encoding, it can't and it will be wrong.   Do not use Java
> FileWriter.
>
> Regards
> Hai
>
>
> On 26 Apr 2006, at 02:00, chuang grace wrote:
>
>> Hi!Everybody..
>> I have a program is output .owl, but chinese word can't implement.
>> my code is
>> import edu.stanford.smi.protegex.owl.jena.*;
>> import edu.stanford.smi.protegex.owl.model.*;
>> import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>> import edu.stanford.smi.protegex.owl.*;
>> import java.util.*;
>> import edu.stanford.smi.protege.plugin.*;
>> import java.net.*;
>> import java.io.*;
>> import java.lang.*;
>> import sun.misc.*
>> import java.awt.*;
>>
>> public class owl5 {
>>  /**
>>   * @param args
>>   */
>>  public static void main(String[] args) {
>>   // TODO Auto-generated method stub
>>
>>
>>   JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
>>      OWLNamedClass personClass = owlModel.createOWLNamedClass("人");
>>      OWLDatatypeProperty ageProperty =
>> owlModel.createOWLDatatypeProperty("年紀");
>>      ageProperty.setRange(owlModel.getXSDint());
>>      ageProperty.setDomain(personClass);
>>      OWLIndividual individual = personClass.createOWLIndividual
>> ("Holger");
>>      individual.setPropertyValue(ageProperty, new Integer(33));
>>      Jena.dumpRDF(owlModel.getOntModel());
>>      owlModel.getOWLDLOntModel().write(System.out);
>>     // Jena.getOWLSpeciesString(owlModel.getOntModel());
>>  }
>> }
>> result:
>> <?xml version="1.0"?>
>> <rdf:RDF
>>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>>     xmlns="http://www.owl-ontologies.com/unnamed.owl#"
>>   xml:base="http://www.owl-ontologies.com/unnamed.owl">
>>   <owl:Ontology rdf:about=""/>
>>   <owl:Class rdf:ID="鈭�"/>
>>   <owl:DatatypeProperty rdf:ID="撟渡��">
>>     <rdfs:domain rdf:resource="#鈭�"/>
>>     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
>>   </owl:DatatypeProperty>
>>   <鈭� rdf:ID="Holger">
>>     <撟渡�� rdf:datatype="http://www.w3.org/2001/ XMLSchema#int">33</撟渡��>
>>   </鈭�>
>> </rdf:RDF>
>> <rdf:RDF
>>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>>     xmlns="http://www.owl-ontologies.com/unnamed.owl#" >
>>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
>> unnamed.owl">
>>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
>>   </rdf:Description>
>>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ unnamed.owl#撟渡��">
>>     <rdf:type rdf:resource="http://www.w3.org/2002/07/ 
>> owl#DatatypeProperty"/>
>>   </rdf:Description>
>>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ unnamed.owl#鈭�">
>>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
>>   </rdf:Description>
>>   <rdf:Description rdf:about="http://www.owl-ontologies.com/ 
>> unnamed.owl#Holger">
>>     <rdf:type rdf:resource="http://www.owl-ontologies.com/ unnamed.owl#鈭�"/>
>>   </rdf:Description>
>> </rdf:RDF>
>> Thanks!
>> ___________________________________________________ 最新版  Yahoo!奇摩即時通訊 7.0,免費網路電話任你打! http:// messenger.yahoo.com.tw/
>
> Regards
> Hai
>
>
> Research Associate
> Department of Computer Science
> Kilburn Building
> University of Manchester
> Oxford Road
> Manchester M13 9PL
> UK
> Homepage: http://www.cs.man.ac.uk/~hwang
>
>
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html