org.w3c.rdf.model
Interface Model

All Known Subinterfaces:
SetModel, VirtualModel
All Known Implementing Classes:
ModelImpl

public abstract interface Model
extends Resource

This is a programming interface to an RDF model. An RDF model is a directed labeled graph. This interface represents a model as container of triples. RDF models must implement getURI() according to a standard MD5-based algorithm.

See Also:
DigestUtil, RDFDigestUtil

Method Summary
 void add(Statement t)
          Adds a new triple to the model.
 boolean contains(Statement t)
          Tests if the model contains the given triple.
 Model create()
          Creates empty model of the same Class
 Model duplicate()
          Clone the model.
 java.util.Enumeration elements()
          Enumerate triples
 Model find(Resource subject, Resource predicate, RDFNode object)
          General method to search for triples.
 NodeFactory getNodeFactory()
          Returns the node factory for this model
 java.lang.String getSourceURI()
          Returns current base URI setting.
 void remove(Statement t)
          Removes the triple from the model.
 void setSourceURI(java.lang.String uri)
          Set a base URI for the model.
 int size()
          Number of triples in the model
 
Methods inherited from interface org.w3c.rdf.model.Resource
getURI
 
Methods inherited from interface org.w3c.rdf.model.RDFNode
getLabel
 

Method Detail

setSourceURI

public void setSourceURI(java.lang.String uri)
Set a base URI for the model. Affects creating of new resources and serialization syntax. Inherited method getURI returns the URI set in this method

getSourceURI

public java.lang.String getSourceURI()
Returns current base URI setting.

size

public int size()
Number of triples in the model
Returns:
number of triples, -1 if unknown

elements

public java.util.Enumeration elements()
Enumerate triples

contains

public boolean contains(Statement t)
Tests if the model contains the given triple.
Returns:
true if the triple belongs to the model; false otherwise.

add

public void add(Statement t)
Adds a new triple to the model.

remove

public void remove(Statement t)
Removes the triple from the model.

find

public Model find(Resource subject,
                  Resource predicate,
                  RDFNode object)
General method to search for triples. null input for any parameter will match anything.

Example: Model result = m.find( null, RDF.type, new ResourceImpl("http://...#MyClass") )

finds all instances of the class MyClass


duplicate

public Model duplicate()
Clone the model.

create

public Model create()
Creates empty model of the same Class

getNodeFactory

public NodeFactory getNodeFactory()
Returns the node factory for this model