ことを仮定:
- はあなたがあなたがあなたのものと下のIRIに置き換わるクラスパス
- にペレットを入れている
- を構築したオントロジーで読み取ることによって、あなたのモデルを移入する方法を知っていますドメイン
- あなたはアサーションは、次のコードスニペットは、INDに年齢を追加します
を有効にしています个々のx-test://individual
とSWIRLによって導入されるプロパティが満たされることを主張する。
// create an empty ontology model using Pellet spec
final OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
// read the file
model.read(ont);
// Grab a resource and and property, and then set the property on that individual
final Resource Adult = ResourceFactory.createResource("x-domain://Adult");
final Property hasAge = ResourceFactory.createProperty("x-domain://hasAge");
final Resource res = model.createResource("x-test://individual");
res.addLiteral(hasAge, 19);
// Test that the swirl rule has executed
assert(res.hasProperty(RDF.type, Adult));