Search Mailing List Archives
[protege-discussion] Convert Project ( Data in Database ) to format xml-rdf.owl
julien lejeune
lejeune.j at gmail.com
Thu Feb 8 02:24:20 PST 2007
Thanks Tania !
I tested with the method "edu.stanford.smi.protegex.owl
.jena.export.JenaExportPlugin.exportProject(KnowledgeBase,
String)".
Problem: In this method there are two case :
// language XML
*if* (kb *instanceof* OWLDatabaseModel) {
OntModel newModel = ((OWLDatabaseModel) kb).getOntModel();
owlModel.save(fileURI, FileUtils.langXML, errors, newModel);
}
// language XML-ABBREV
*else* { *// Any other Protege format
* *// TODO: owlModel.initWithProtegeMetadataOntology(errors);
* *new* ProtegeSaver(kb, owlModel).run();
owlModel.save(fileURI, FileUtils.langXMLAbbrev, errors);
}
I would like doing my extraction in language XML but my object "
project.KnowledgeBase()" is not a "OWLDatabaseModel".
If I cast my object like : KnowledgeBase kb = (OWLDatabaseModel)
project.getKnowledgeBase(); , I have the error :
java.lang.ClassCastException :
edu.standford.smi.protege.model.DefaultKnowledgeBase
I don't see how I could do !!!
I hope you can help me !
Julien
On 2/7/07, Tania Tudorache <tudorache at stanford.edu> wrote:
>
> Julien,
>
> So you have a frames project and want to export it as an OWL file, right?
>
> You can use the same code as the one in the method:
>
> edu.stanford.smi.protegex.owl.jena.export.JenaExportPlugin.exportProject
> (KnowledgeBase,
> String)
>
>
> You can see the JenaExportPlugin source code here:
>
>
> http://smi-protege.stanford.edu/svn/owl/trunk/src/edu/stanford/smi/protegex/owl/jena/export/JenaExportPlugin.java?rev=1640&view=markup
>
> Tania
>
>
>
>
> julien lejeune wrote:
> > Hi,
> >
> > I'm trying to convert my project to format xml-rdf.owl.
> > I would like only extract data from the database schema of my project
> > and create a file <myproject>.xml-rdf.owl.
> >
> > In the opposite of the function in the protege menu ( File > Convert
> > project to format ... language = XML/RDF ) I don't want to transform
> > my project on OWL project.
> >
> > I already try this code :
> > ArrayList errors = new ArrayList();
> >
> > JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
> > JenaKnowledgeBaseFactory factory =
> > (JenaKnowledgeBaseFactory)owlModel.getKnowledgeBaseFactory();
> > project.setKnowledgeBaseFactory(factory);
> > project.createDomainKnowledgeBase(factory,errors,false);
> > JenaOWLModel model = (JenaOWLModel)
> > project.getKnowledgeBase();
> > try {
> > com.hp.hpl.jena.ontology.OntModel jena =
> > model.getOntModel();
> > try {
> >
> > FileOutputStream stream = new
> > FileOutputStream(_strOutputFileRep+"/"+project.getName()+".rdf- xml.owl
> ");
> > jena.write(stream, "RDF/XML");
> > stream.close();
> > } catch (IOException ioe) {
> > ioe.printStackTrace();
> > }
> > }
> >
> > But my file <myproject>.rdf-xml.owl is quite empty ( 1 Ko ). There is
> > only the header of an OWL file :
> > <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:RDF>
> >
> > And I have warnings in the DOS windows :
> > WARNING : unknown class : mapping set -- Project.loadWidgetDescriptors()
> >
> > WARNING : unknown class : APPLICATIONS -- Project.loadWidgetDescriptors
> ()
> >
> > WARNING : unknown class : DOCUMENTS -- Project.loadWidgetDescriptors()
> >
> > WARNING : unknown class : INFORMATIONS -- Project.loadWidgetDescriptors
> ()
> >
> > etc ... (for all classes)
> >
> >
> > Can somebody give me more informations about this subject?
> >
> > Thanks
> >
> > Julien
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > protege-discussion mailing list
> > protege-discussion at lists.stanford.edu
> > https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> >
> > Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03
> >
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20070208/d0ca16ff/attachment.html>
More information about the protege-discussion
mailing list