次のイエナコードを書きました。しかし、それはエラーであり、私はこれに対処する方法を知りませんでした。
これがコードです
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
クラスですが、範囲はint
です。
返信ありがとうございます!