Add most properties to TBox

This commit is contained in:
Jan Philipp Timme 2017-11-20 22:33:28 +01:00
parent 730b45057d
commit 6408bec808

View File

@ -26,29 +26,81 @@ public class Generator {
// Some boilerplate stuff // Some boilerplate stuff
Property rdfType = model.createProperty(rdfUri+"type"); Property rdfType = model.createProperty(rdfUri+"type");
Resource rdfClass = model.createResource(rdfUri+"Class"); Resource rdfClass = model.createResource(rdfUri+"Class");
Resource rdfProperty = model.createResource(rdfUri+"Property");
Property rdfsSubclassOf = model.createProperty(rdfsUri+"subclassOf"); Property rdfsSubclassOf = model.createProperty(rdfsUri+"subclassOf");
Property rdfsDomain = model.createProperty(rdfsUri+"domain");
Property rdfsRange = model.createProperty(rdfsUri+"range");
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"); Resource gameConsole = model.createResource(ownUri+"GameConsole");
Resource portableGameConsole = model.createResource(ownUri+"PortableGameConsole"); Resource portableGameConsole = model.createResource(ownUri+"PortableGameConsole");
// Add statements to the model
model.add(model.createStatement(gameConsole, rdfType, rdfClass)); model.add(model.createStatement(gameConsole, rdfType, rdfClass));
model.add(model.createStatement(portableGameConsole, rdfType, rdfClass)); model.add(model.createStatement(portableGameConsole, rdfType, rdfClass));
model.add(model.createStatement(portableGameConsole, rdfsSubclassOf, gameConsole)); model.add(model.createStatement(portableGameConsole, rdfsSubclassOf, gameConsole));
/* // Add properties to the model
Resource donald = model.createResource(familyUri + "donald"); Resource ceo = model.createProperty(ownUri+"ceo");
Resource tick = model.createResource(familyUri + "tick"); ceo.addProperty(rdfType, rdfProperty);
ceo.addProperty(rdfsDomain, foafOrganization);
ceo.addProperty(rdfsRange, foafPerson);
Property childOf = model.createProperty(relationshipUri, "childOf"); Resource foundingYear = model.createProperty(ownUri+"foundingYear");
Property knows = model.createProperty(relationshipUri, "knows"); foundingYear.addProperty(rdfType, rdfProperty);
tick.addProperty(childOf, donald); foundingYear.addProperty(rdfsDomain, foafOrganization);
foundingYear.addProperty(rdfsRange, xsdInt);
Statement st1 = model.createStatement(donald, knows, tick); Resource internetEnabled = model.createProperty(ownUri+"internetEnabled");
model.add(st1); internetEnabled.addProperty(rdfType, rdfProperty);
*/ internetEnabled.addProperty(rdfsDomain, gameConsole);
internetEnabled.addProperty(rdfsRange, xsdBoolean);
Generator.writeModelToFile(model, "./tbox.ttl"); Resource consoleName = model.createProperty(ownUri+"consoleName");
consoleName.addProperty(rdfType, rdfProperty);
consoleName.addProperty(rdfsDomain, gameConsole);
consoleName.addProperty(rdfsRange, xsdString);
Resource numOfSupportedControllers = model.createProperty(ownUri+"numOfSupportedControllers");
numOfSupportedControllers.addProperty(rdfType, rdfProperty);
numOfSupportedControllers.addProperty(rdfsDomain, gameConsole);
numOfSupportedControllers.addProperty(rdfsRange, xsdInt);
Resource predecessorOfConsole = model.createProperty(ownUri+"predecessorOfConsole");
predecessorOfConsole.addProperty(rdfType, rdfProperty);
predecessorOfConsole.addProperty(rdfsDomain, gameConsole);
predecessorOfConsole.addProperty(rdfsRange, gameConsole);
Resource successorOfConsole = model.createProperty(ownUri+"successorOfConsole");
successorOfConsole.addProperty(rdfType, rdfProperty);
successorOfConsole.addProperty(rdfsDomain, gameConsole);
successorOfConsole.addProperty(rdfsRange, gameConsole);
Resource relatedToConsole = model.createProperty(ownUri+"relatedToConsole");
relatedToConsole.addProperty(rdfType, rdfProperty);
relatedToConsole.addProperty(rdfsDomain, gameConsole);
relatedToConsole.addProperty(rdfsRange, gameConsole);
Resource releaseYear = model.createProperty(ownUri+"releaseYear");
releaseYear.addProperty(rdfType, rdfProperty);
releaseYear.addProperty(rdfsDomain, gameConsole);
releaseYear.addProperty(rdfsRange, xsdInt);
Resource madeBy = model.createProperty(ownUri+"madeBy");
madeBy.addProperty(rdfType, rdfProperty);
madeBy.addProperty(rdfsDomain, gameConsole);
madeBy.addProperty(rdfsRange, foafOrganization);
// Store the model into a file
Generator.writeModelToFile(model, "./output/tbox.ttl");
} }
private static void writeModelToFile(Model model, String path) { private static void writeModelToFile(Model model, String path) {