Previous Topic

Next Topic

Reify Triples

A statement can be made about another statement using reification. JRDF supports reification via a TripleFactory obtained using a graph's getTripleFactory() method. The following code inserts a reified statement:

TripleFactory tripleFactory = graph.getTripleFactory();

//create a resource to identify the statement
URIReference statement = elementFactory.createResource
(new URI("http://example.org/statement#address"));

//reify the address statement (person, hasAddress, address)
tripleFactory.reifyTriple(addressStatement, statement);

//insert a statement about the original statement
URIReference manager = elementFactory.createResource(new URI("http://example.org/managerid#65"));
URIReference hasConfirmed = elementFactory.createResource
(new URI("http://example.org/terms#hasConfirmed"));
Triple confirmationStatement = elementFactory.createTriple(manager, hasConfirmed, statement);
graph.add(confirmationStatement);

The graph now contains:

http://example.org/staffid#85740  http://example.org/terms#address     _blankNode123
_blankNode123                     http://example.org/terms#street      "1501 Grant Avenue"
_blankNode123                     http://example.org/terms#city        "Bedford"
_blankNode123                     http://example.org/terms#state       "Massachusetts"
_blankNode123                     http://example.org/terms#postalCode  "01730"

http://example.org/managerid#65       http://example.org/terms#hasConfirmed
  http://example.org/statement#address
http://example.org/statement#address  http://www.w3.org/1999/02/22-rdf-syntax-ns#subject
  http://example.org/staffid#85740
http://example.org/statement#address  http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate
  http://example.org/terms#address
http://example.org/statement#address  http://www.w3.org/1999/02/22-rdf-syntax-ns#object
  _blankNode123
http://example.org/statement#address  http://www.w3.org/1999/02/22-rdf-syntax-ns#type
  http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement

See Also

JRDF Tutorial

Prerequisites

Obtaining a Session from a Kowari Server

Comparison of JRDF Graph Implementations

Creating the Graph

Creating Nodes and Triples

Adding Triples to the Graph

Searching the Graph

Removing Triples from the Graph

Latest News

Kowari 1.1.0 Pre-release 1 Released

Kowari 1.0.5 Released

Kowari 1.0.4.1 Released

Kowari 1.0.4 Released

DAWG Evaluates iTQL

Kowari article in XML.com

Kowari mentioned on XML.com

Kowari 1.0.3 Released

Kowari Lite Introduced

Kowari 1.0.2 Released

Kowari 1.0.1 Released

View all news items


Open Source logo Tucana Technologies Logo SourceForge.net Logo

© 2001-2004 Tucana Technologies, Inc. Some rights reserved.