Search Mailing List Archives
[protege-discussion] Loading an Ontology
Qingmai Wang
qingmai.w at gmail.com
Tue Mar 23 16:27:02 PDT 2010
Hi All,
I am new to protege and also new to this discussion list. I am just starting
to program an JAVA GUI to manage OWL ontology using protege jars. I meet
some problem when I try to load a ontology from a local file. Following is
the code, in which a JFileChooser is used to select the file .
private void OpenFile() throws OntologyLoadException{
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("OWL
file","OWL");
chooser.addChoosableFileFilter(filter);
int result = chooser.showOpenDialog(this);
if(result == JFileChooser.CANCEL_OPTION) return;
File file = chooser.getSelectedFile();
String path = file.getPath();
path = path.replaceAll("\\\\", "/");
String uri = "file:///" + path;
System.out.printf(uri);
JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
}
The Eclipse returns the following errors:
in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory;
I have try to define the String uri straightly as "String uri =
"file:///D:/work/ProtegeDeveloper/travel-saved.owl";" , it remains same
errors.
By the way, it is really confused because it works well when I try the
loading process in a independent normal java main class as following:
public static void main(String[] args) throws OntologyLoadException {
String uri =
"file:///D:/work/ProtegeDeveloper/travel-saved.owl";
JenaOWLModel owlModel =
ProtegeOWL.createJenaOWLModelFromURI(uri);
}
Thanks very much if anyone could help
Best regards
Qingmai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20100324/c0565afe/attachment.html>
More information about the protege-discussion
mailing list