Wie kann ich eine OntModel-Instanz in einen Triple Store (wie TDB) mit ARQ (SPARQL-Prozessor für Jena?) Einfügen . Code, der einfach Bücher erstellt, und fügen sie diese in eine OntModel Jetzt möchte ich dies in einem Triple-Shop einfügen:?.Einfügen einer OntModel-Instanz in einen Triple Store (wie TDB) mit ARQ (SPARQL-Prozessor für Jena)
public static void createDummyBooks(){
// Create an empty ontology model
OntModel ontModel = ModelFactory.createOntologyModel();
String ns = new String("http://www.iexample.com/book#");
String baseURI = new String("http://www.iexample.com/book");
Ontology onto = ontModel.createOntology(baseURI);
//creating a book
OntClass book = ontModel.createClass(ns + "Book");
OntClass nonFinctionBook = ontModel.createClass(ns + "NonFictionBook");
OntClass fictionBook = ontModel.createClass(ns + "FictionBook");
// Create datatype property 'hasAge'
DatatypeProperty hasTtitle = ontModel.createDatatypeProperty(ns + "hasTitle");
// 'hasAge' takes integer values, so its range is 'integer'
// Basic datatypes are defined in the ‘vocabulary’ package
hasTtitle.setDomain(book);
hasTtitle.setRange(XSD.xstring); // com.hp.hpl.jena.vocabulary.XSD
// Create individuals
Individual theProgrammingBook = nonFinctionBook.createIndividual(ns + "ProgrammingBook");
Individual theFantasyBook = fictionBook.createIndividual(ns + "FantasyBook");
Literal bookTitle = ontModel.createTypedLiteral("Programming with Ishmael", XSDDatatype.XSDstring);
Literal fantasyBookTitle = ontModel.createTypedLiteral("The adventures of Ishmael", XSDDatatype.XSDstring);
// Create statement 'ProgrammingBook hasTitle "Programming with Ishmael" '
Statement theProgrammingBookHasTitle = ontModel.createStatement(nonFinctionBook, hasTtitle, bookTitle);
// Create statement 'FantasyBook hasTitle "The adventures of Ishmael" '
Statement theFantasyBookHasTitle = ontModel.createStatement(theFantasyBook, hasTtitle, fantasyBookTitle);
List<Statement> statements = new ArrayList<Statement>();
statements.add(theProgrammingBookHasTitle);
statements.add(theFantasyBookHasTitle);
ontModel.add(statements);
//just displaying here - but how do I now write/insert this into my Triple Store/TDB using AQR API?
ontModel.write(System.out, "RDF/XML-ABBREV");
}
Irgendwelche Ideen Sehr geschätzt
Warum würden Sie diese Frage ablehnen, ohne sich darum zu kümmern, was Sie nicht hilfreich finden - arbeiten Sie sogar im Bereich der Entwicklung von Ontologien? Wenn Sie die Frage nicht beantworten können, überspringen Sie sie einfach und sehen Sie sich andere Fragen an, bei denen Sie helfen können. – ishmaelMakitla