Class Graph

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<Link>, java.util.Collection<Link>, java.util.Set<Link>

    public class Graph
    extends java.util.concurrent.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

      Constructors 
      Constructor Description
      Graph()
      Default constructor.
      Graph​(Link defaultLink)
      Constructor with a default link.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Link add​(java.lang.String sourceRef, java.lang.String typeRef, org.restlet.data.Reference targetRef)
      Creates then adds a link.
      Link add​(java.lang.String sourceRef, java.lang.String typeRef, Literal targetLit)
      Creates then adds a link.
      Link add​(java.lang.String sourceRef, org.restlet.data.Reference typeRef, org.restlet.data.Reference targetRef)
      Creates then adds a link.
      Link add​(java.lang.String sourceRef, org.restlet.data.Reference typeRef, Literal targetLit)
      Creates then adds a link.
      Link add​(org.restlet.data.Reference sourceRef, java.lang.String typeRef, org.restlet.data.Reference targetRef)
      Creates then adds a link.
      Link add​(org.restlet.data.Reference sourceRef, java.lang.String typeRef, Literal targetLit)
      Creates then adds a link.
      Link add​(org.restlet.data.Reference sourceRef, org.restlet.data.Reference typeRef, org.restlet.data.Reference targetRef)
      Creates then adds a link.
      Link add​(org.restlet.data.Reference sourceRef, org.restlet.data.Reference typeRef, Literal targetLit)
      Creates then adds a link.
      Link add​(Graph sourceGraph, org.restlet.data.Reference typeRef, org.restlet.data.Reference targetRef)
      Creates then adds a link.
      Link add​(Graph sourceGraph, org.restlet.data.Reference typeRef, Literal targetLit)
      Creates then adds a link.
      Link addLiteral​(java.lang.String sourceRef, java.lang.String typeRef, java.lang.String targetLit)
      Creates then adds a link.
      Link addLiteral​(Graph sourceGraph, java.lang.String typeRef, java.lang.String targetLit)
      Creates then adds a link.
      Link addReference​(java.lang.String sourceRef, java.lang.String typeRef, java.lang.String targetRef)
      Creates then adds a link.
      Link addReference​(Graph sourceGraph, java.lang.String typeRef, java.lang.String targetRef)
      Creates then adds a link.
      Link getDefaultLink()
      Returns the default link that is used to complete new links.
      org.restlet.representation.Representation getRdfN3Representation()
      Returns a representation in the RDF/n3 format.
      org.restlet.representation.Representation getRdfNTriplesRepresentation()
      Returns a representation in the RDF/N-Triples format.
      org.restlet.representation.Representation getRdfTurtleRepresentation()
      Returns a representation in the RDF/Turtle format.
      org.restlet.representation.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, forEach, isEmpty, iterator, remove, removeAll, removeIf, retainAll, size, spliterator, 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
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
    • 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,
                        org.restlet.data.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,
                        org.restlet.data.Reference typeRef,
                        org.restlet.data.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​(org.restlet.data.Reference sourceRef,
                        org.restlet.data.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​(org.restlet.data.Reference sourceRef,
                        org.restlet.data.Reference typeRef,
                        org.restlet.data.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​(org.restlet.data.Reference sourceRef,
                        java.lang.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​(org.restlet.data.Reference sourceRef,
                        java.lang.String typeRef,
                        org.restlet.data.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​(java.lang.String sourceRef,
                        org.restlet.data.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​(java.lang.String sourceRef,
                        org.restlet.data.Reference typeRef,
                        org.restlet.data.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​(java.lang.String sourceRef,
                        java.lang.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​(java.lang.String sourceRef,
                        java.lang.String typeRef,
                        org.restlet.data.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,
                               java.lang.String typeRef,
                               java.lang.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​(java.lang.String sourceRef,
                               java.lang.String typeRef,
                               java.lang.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,
                                 java.lang.String typeRef,
                                 java.lang.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​(java.lang.String sourceRef,
                                 java.lang.String typeRef,
                                 java.lang.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 org.restlet.representation.Representation getRdfN3Representation()
        Returns a representation in the RDF/n3 format.
        Returns:
        A representation in the RDF/n3 format.
      • getRdfNTriplesRepresentation

        public org.restlet.representation.Representation getRdfNTriplesRepresentation()
        Returns a representation in the RDF/N-Triples format.
        Returns:
        A representation in the RDF/N-Triples format.
      • getRdfTurtleRepresentation

        public org.restlet.representation.Representation getRdfTurtleRepresentation()
        Returns a representation in the RDF/Turtle format.
        Returns:
        A representation in the RDF/Turtle format.
      • getRdfXmlRepresentation

        public org.restlet.representation.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.