org.restlet.ext.rdf
Class Graph

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.concurrent.CopyOnWriteArraySet<Link>
              extended by org.restlet.ext.rdf.Graph
All Implemented Interfaces:
Serializable, Iterable<Link>, Collection<Link>, Set<Link>

public class Graph
extends CopyOnWriteArraySet<Link>

Graph composed of links. This also called a set of RDF statements or a RDF model.

Author:
Jerome Louvel
See Also:
Serialized Form

Constructor Summary
Graph()
          Default constructor.
Graph(Link defaultLink)
          Constructor with a default link.
 
Method Summary
 Link add(Graph sourceGraph, Reference typeRef, Literal targetLit)
          Creates then adds a link.
 Link add(Graph sourceGraph, Reference typeRef, Reference targetRef)
          Creates then adds a link.
 Link add(Reference sourceRef, Reference typeRef, Literal targetLit)
          Creates then adds a link.
 Link add(Reference sourceRef, Reference typeRef, Reference targetRef)
          Creates then adds a link.
 Link add(Reference sourceRef, String typeRef, Literal targetLit)
          Creates then adds a link.
 Link add(Reference sourceRef, String typeRef, Reference targetRef)
          Creates then adds a link.
 Link add(String sourceRef, Reference typeRef, Literal targetLit)
          Creates then adds a link.
 Link add(String sourceRef, Reference typeRef, Reference targetRef)
          Creates then adds a link.
 Link add(String sourceRef, String typeRef, Literal targetLit)
          Creates then adds a link.
 Link add(String sourceRef, String typeRef, Reference targetRef)
          Creates then adds a link.
 Link addLiteral(Graph sourceGraph, String typeRef, String targetLit)
          Creates then adds a link.
 Link addLiteral(String sourceRef, String typeRef, String targetLit)
          Creates then adds a link.
 Link addReference(Graph sourceGraph, String typeRef, String targetRef)
          Creates then adds a link.
 Link addReference(String sourceRef, String typeRef, String targetRef)
          Creates then adds a link.
 Link getDefaultLink()
          Returns the default link that is used to complete new links.
 Representation getRdfN3Representation()
          Returns a representation in the RDF/n3 format.
 Representation getRdfNTriplesRepresentation()
          Returns a representation in the RDF/N-Triples format.
 Representation getRdfTurtleRepresentation()
          Returns a representation in the RDF/Turtle format.
 Representation getRdfXmlRepresentation()
          Returns a representation in the RDF/XML format.
 void setDefaultLink(Link defaultLink)
          Sets the default link that is used to complete new links.
 
Methods inherited from class java.util.concurrent.CopyOnWriteArraySet
add, addAll, clear, contains, containsAll, equals, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSet
hashCode
 
Methods inherited from class java.util.AbstractCollection
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Graph

public Graph()
Default constructor.


Graph

public Graph(Link defaultLink)
Constructor with a default link.

Parameters:
defaultLink - The link to use when adding links with missing properties.
Method Detail

add

public Link add(Graph sourceGraph,
                Reference typeRef,
                Literal targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceGraph - The source graph.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

add

public Link add(Graph sourceGraph,
                Reference typeRef,
                Reference targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceGraph - The source graph.
typeRef - The type reference.
targetRef - The target reference.
Returns:
The created link.

add

public Link add(Reference sourceRef,
                Reference typeRef,
                Literal targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

add

public Link add(Reference sourceRef,
                Reference typeRef,
                Reference targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetRef - The target resource reference.
Returns:
The created link.

add

public Link add(Reference sourceRef,
                String typeRef,
                Literal targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

add

public Link add(Reference sourceRef,
                String typeRef,
                Reference targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetRef - The target resource reference.
Returns:
The created link.

add

public Link add(String sourceRef,
                Reference typeRef,
                Literal targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

add

public Link add(String sourceRef,
                Reference typeRef,
                Reference targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetRef - The target resource reference.
Returns:
The created link.

add

public Link add(String sourceRef,
                String typeRef,
                Literal targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

add

public Link add(String sourceRef,
                String typeRef,
                Reference targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetRef - The target resource reference.
Returns:
The created link.

addLiteral

public Link addLiteral(Graph sourceGraph,
                       String typeRef,
                       String targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceGraph - The source graph.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

addLiteral

public Link addLiteral(String sourceRef,
                       String typeRef,
                       String targetLit)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetLit - The target literal.
Returns:
The created link.

addReference

public Link addReference(Graph sourceGraph,
                         String typeRef,
                         String targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceGraph - The source graph.
typeRef - The type reference.
targetRef - The target reference.
Returns:
The created link.

addReference

public Link addReference(String sourceRef,
                         String typeRef,
                         String targetRef)
Creates then adds a link. If one of the parameter is null, the value from getDefaultLink() is used instead if possible.

Parameters:
sourceRef - The source resource reference.
typeRef - The type reference.
targetRef - The target resource reference.
Returns:
The created link.

getDefaultLink

public Link getDefaultLink()
Returns the default link that is used to complete new links.

Returns:
The default link that is used to complete new links.

getRdfN3Representation

public Representation getRdfN3Representation()
Returns a representation in the RDF/n3 format.

Returns:
A representation in the RDF/n3 format.

getRdfNTriplesRepresentation

public Representation getRdfNTriplesRepresentation()
Returns a representation in the RDF/N-Triples format.

Returns:
A representation in the RDF/N-Triples format.

getRdfTurtleRepresentation

public Representation getRdfTurtleRepresentation()
Returns a representation in the RDF/Turtle format.

Returns:
A representation in the RDF/Turtle format.

getRdfXmlRepresentation

public Representation getRdfXmlRepresentation()
Returns a representation in the RDF/XML format.

Returns:
A representation in the RDF/XML format.

setDefaultLink

public void setDefaultLink(Link defaultLink)
Sets the default link that is used to complete new links.

Parameters:
defaultLink - The default link that is used to complete new links.


Copyright © 2005-2013 Restlet.