PowerPoint PresentationSlide 2Slide 3Slide 4Slide 5Multiple ReificationsSlide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30JENA REIFICATION APIReificationReificationIn these slides we take a look at Reification and how Reification is done in the Jena APIReification (in Jena) is the ability to treat a Statement as a ResourceReify - to regard (something abstract) as a material or concrete thingAs in ‘to make it real’ReificationThen, additional assertions can be made about this StatementA Statement can be reified multiple times which allows different “manifestations” of that statement to be treated differently if requiredStripesrdf:typeZebrardf:label‘Stripes’R1rdf:Statementrdf:typerdf:subjectrdf:predicaterdf:objectReificationRDF represents a reified statement as four statements with particular RDF properties and objectsStatement (S, P, O), reified by resource R, is:R rdf:type rdf:StatementR rdf:subject SR rdf:predicate PR rdf:object OReificationThe purpose of a reified statement is to provide additional detail about the statement of interestUser selected properties are necessary – like Dublin CoreR rdf:type rdf:StatementR rdf:subject SR rdf:predicate PR rdf:object OR dc:creator ‘steven’R dc:date ‘09/30/2009’Apparently Steven made the statement (S, P, O) on 9/30/2009Multiple ReificationsR1 rdf:type rdf:StatementR1 rdf:subject SR1 rdf:predicate PR1 rdf:object OR1 dc:creator ‘politician’R1 sc:creatorReliability ‘low’R2 rdf:type rdf:StatementR2 rdf:subject SR2 rdf:predicate PR2 rdf:object OR2 dc:creator ‘street vendor’R2 sc:creatorReliability ’medium’•Multiple reification nodes may refer to the same statement. This can show multiple provenance paths or be part of mechanisms involved in accumulating confidence regarding the statement.Apparently the statement (S, P, O) was reported by both a politician and street vendor. It appears someone has varying opinions about the reliability of the two independent sources of the statement.RDF/XML Example<?xml version="1.0"?><!DOCTYPE rdf:RDF [<!ENTITY dc "http://purl.org/dc/elements/1.1/" >]><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="&dc;"xmlns:exterms="http://www.example.org/terms/”xmlns:other=“http://myuri.org/other#"> <rdf:Description rdf:about="http://www.example.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date> <dc:language>en</dc:language> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> </rdf:Description> <rdf:Statement rdf:about="A1"> <rdf:subject rdf:resource="http://www.example.org/index.html"/> <rdf:predicate rdf:resource="&dc;creator"/> <rdf:object rdf:resource="http://www.example.org/staffid/85740"/> <dc:creator>"Marty"</dc:creator> <other:creatorConfidenceInFact>"95%"</other:creatorConfidenceInFact> </rdf:Statement></rdf:RDF>Jena ReificationJena represents a reified statement as a reification quad and each component is a quadletUsers can directly manipulate the quads in Jena or use the additional support that Jena providesJena optimizes the storage for the reification quads avoiding having to store the extra four statements for a single reified statementJENA REIFICATION API DETAILSBackupReificationJena uses the ReifiedStatement interface to represent a reified statement as a Jena resourceJena provides a function to find the statement that is being reified using the function:ReifiedStatement::getStatement()ReificationCreating Reified Statements from a Resource in JenaConsider a resource R associated with a reified statement but is itself not a ReifiedStatement object—a case in which the resource can itself be directly converted to a reified statement(ReifiedStatement) R.as(ReifiedStatement.class)Knowing a resource name allows a ReifiedStatement object to be constructed without actually knowing the statementReificationCreating Reified Statements from a Resource in Jena(continued…)If no associated reified statements actually exist, the “CannotReifyException” is thrownTo find out if a reification is possible we can use the predicate:RDFNode::canAs(ReifiedStatement.class)ReificationTesting Statements for Reification in JenaUsers may wish to test if a certain statement is reifiedMethods such as:Statement::isReified() orModel::isReified(Statement)return true “if and only if” the statement is reified in the modelThe first method tests that the statement is reified in its own model while the second method tests that the statement is reified in the given model, it doesn’t test it in any other modelReificationListing Reified Statements in JenaThese functions works the same way as listStatements()Each returns a RSIterator object where each element is a ReifiedStatement and nextRS() delivers the reified statement…and they are…ReificationListing Reified Statements in Jena (continued…)Statement::listReifiedStatements() – lists all reifications of the statement in the current modelModel::listReifiedStatements() – lists all reified statements in this modelModel::listReifiedStatements(Statement s) – lists all reified statements reifying “s” in this modelReificationCreating Reified Statements from Statements in JenaReified statements do not necessarily have to be created by asserting their quads into a model; they can be directly created from their statements:Statement::createReifiedStatement()Statement::createReifiedStatement(URIString)(…continued…)ReificationCreating Reified Statements from Statements in Jena(continued…)Model::createReifiedStatement(Statement)Model::createReifiedStatement(URIString, Statement)Each of the above functions returns a ReifiedStatement object who’s getStatement() method delivers the original statementReificationCreating Reified Statements from Statements in Jena(continued…)If the methods use the form in which the String is non-null, the ReifiedStatement created is a named resource and the String is its URIOtherwise, it is a bnodeThe previous Statement methods create a ReifiedStatement in that Statement’s modelThe previous Model methods create a ReifiedStatement in that modelReificationCreating Reified Statements from Statements in
View Full Document