From 950ead445d532df1d8d498dd0afc76e113727aaa Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 20 Nov 2017 22:38:09 +0100 Subject: [PATCH] Finish generator for TBox --- data/tbox.ttl | 7 ------- src/main/java/hsh/ins_jena/model/Generator.java | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/data/tbox.ttl b/data/tbox.ttl index 1a5e86a..e6fd303 100644 --- a/data/tbox.ttl +++ b/data/tbox.ttl @@ -5,13 +5,6 @@ @prefix foaf: . @prefix rev: . -# Our classes -:GameConsole rdf:type rdf:Class . - -:PortableGameConsole rdf:type rdf:Class ; - rdfs:subclassOf :GameConsole . - - # Our own properties :ceo rdf:type rdf:Property ; rdfs:domain foaf:Organization ; diff --git a/src/main/java/hsh/ins_jena/model/Generator.java b/src/main/java/hsh/ins_jena/model/Generator.java index 3673800..c478f33 100644 --- a/src/main/java/hsh/ins_jena/model/Generator.java +++ b/src/main/java/hsh/ins_jena/model/Generator.java @@ -29,15 +29,20 @@ public class Generator { Resource rdfProperty = model.createResource(rdfUri+"Property"); Property rdfsSubclassOf = model.createProperty(rdfsUri+"subclassOf"); + Property rdfsSubPropertyOf = model.createProperty(rdfsUri+"subPropertyOf"); Property rdfsDomain = model.createProperty(rdfsUri+"domain"); Property rdfsRange = model.createProperty(rdfsUri+"range"); + Property rdfsLabel = model.createProperty(rdfsUri+"label"); + Property rdfsDatatype = model.createProperty(rdfsUri+"Datatype"); + Resource foafPerson = model.createResource(foafUri+"Person"); Resource foafOrganization = model.createResource(foafUri+"Organization"); Resource xsdInt = model.createResource(xsdUri+"int"); Resource xsdBoolean = model.createResource(xsdUri+"boolean"); Resource xsdString = model.createResource(xsdUri+"string"); + // Own classes Resource gameConsole = model.createResource(ownUri+"GameConsole"); @@ -99,6 +104,15 @@ public class Generator { madeBy.addProperty(rdfsDomain, gameConsole); madeBy.addProperty(rdfsRange, foafOrganization); + // Declare our datatype + Resource priceEur = model.createResource(ownUri+"PriceEur"); + priceEur.addProperty(rdfType, rdfsDatatype); + priceEur.addProperty(rdfsLabel, "Preis in Euro"); + + // Use of subPropertyOf + predecessorOfConsole.addProperty(rdfsSubPropertyOf, relatedToConsole); + successorOfConsole.addProperty(rdfsSubPropertyOf, relatedToConsole); + // Store the model into a file Generator.writeModelToFile(model, "./output/tbox.ttl"); }