我编写了以下耶拿代码。但这是一个错误,我不知道如何解决这个问题。
这是代码
Resource subject = null;
Property property = null;
Statement statement = null;
...
OntModel domainModel = ModelFactory.createOntologyModel(ProfileRegistry.OWL_DL_LANG);
domainModel.read((new FileInputStream(bootstrapInOwl)), null);
subject = domainModel.getIndividual(bootbase + "Frame" + frameNum);
property = domainModel.getOntProperty(bootbase + "hasDuration");
statement = domainModel.createLiteralStatement(subject, property, 12000);
domainModel.add(statement);
这是错误消息
Exception in thread "main" java.lang.NullPointerException
at com.hp.hpl.jena.rdf.model.impl.StatementImpl.<init>(StatementImpl.java:29)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.createStatement(ModelCom.java:1116)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.createLiteralStatement(ModelCom.java:626)
at soctrace.Intology.manageOntologies2(Intology.java:217)
at soctrace.Intology.main(Intology.java:56)
属性hasDuration
域是Frame
Class 而他的范围是int
。
感谢您的回复!