我在netbeans中添加了jena api。运行以下代码后,它显示此行中的错误 OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); csr.owl是我的本体文件名
我的代码:
public class JavaApplication1 {
private static Object ModelFactory;
private static Object OntModelSpec;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String filename = "csr.owl";
try
{
File file = new File(filename);
FileReader reader= new FileReader(file);
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
model.read(reader,null);
model.write(System.out,"RDF/XML-ABBREV");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}