Class JsonLdDatasetImpl

    • Constructor Detail

      • JsonLdDatasetImpl

        JsonLdDatasetImpl​(com.github.jsonldjava.core.RDFDataset rdfDataSet)
      • JsonLdDatasetImpl

        JsonLdDatasetImpl​(com.github.jsonldjava.core.RDFDataset rdfDataset,
                          java.lang.String bnodePrefix)
      • JsonLdDatasetImpl

        JsonLdDatasetImpl​(java.lang.String bnodePrefix)
    • Method Detail

      • add

        public void add​(BlankNodeOrIRI graphName,
                        BlankNodeOrIRI subject,
                        IRI predicate,
                        RDFTerm object)
        Description copied from interface: Dataset
        Add a quad to the dataset, possibly mapping any of the components to those supported by this dataset.
        Specified by:
        add in interface Dataset
        Overrides:
        add in class AbstractJsonLdGraphLike<Quad>
        Parameters:
        graphName - The graph the quad belongs to, or null for the default graph
        subject - The quad subject
        predicate - The quad predicate
        object - The quad object
      • contains

        public boolean contains​(java.util.Optional<BlankNodeOrIRI> graphName,
                                BlankNodeOrIRI subject,
                                IRI predicate,
                                RDFTerm object)
        Description copied from interface: Dataset
        Check if dataset contains a pattern of quads.
        Specified by:
        contains in interface Dataset
        Overrides:
        contains in class AbstractJsonLdGraphLike<Quad>
        Parameters:
        graphName - The graph the quad belongs to, wrapped as an Optional (null is a wildcard, Optional.empty() is the default graph)
        subject - The quad subject (null is a wildcard)
        predicate - The quad predicate (null is a wildcard)
        object - The quad object (null is a wildcard)
        Returns:
        True if the dataset contains any quads that match the given pattern.
      • getGraph

        public Graph getGraph()
        Description copied from interface: Dataset
        Get the default graph of this dataset.

        The Triples of the default graph are equivalent to the Quads in this Dataset which has the Quad.getGraphName() set to Optional.empty().

        It is unspecified if modifications to the returned Graph are reflected in this Dataset.

        The returned graph MAY be empty.

        Specified by:
        getGraph in interface Dataset
        Returns:
        The default graph of this Dataset
        See Also:
        Dataset.getGraph(BlankNodeOrIRI)
      • getGraph

        public java.util.Optional<Graph> getGraph​(BlankNodeOrIRI graphName)
        Description copied from interface: Dataset
        Get a named graph in this dataset.

        The Triples of the named graph are equivalent to the the Quads of this Dataset which has the Quad.getGraphName() equal to the provided graphName, or equal to Optional.empty() if the provided graphName is null.

        It is unspecified if modifications to the returned Graph are reflected in this Dataset.

        It is unspecified if requesting an unknown or empty graph will return Optional.empty() or create a new empty Graph.

        Specified by:
        getGraph in interface Dataset
        Parameters:
        graphName - The name of the graph, or null for the default graph.
        Returns:
        The named Graph, or Optional.empty() if the dataset do not contain the named graph.
        See Also:
        Dataset.getGraph(), Dataset.getGraphNames()
      • getGraphNames

        public java.util.stream.Stream<BlankNodeOrIRI> getGraphNames()
        Description copied from interface: Dataset
        Get the graph names in this Dataset.

        The set of returned graph names is equivalent to the set of unique Quad.getGraphName() of all the Dataset.stream() of this dataset (excluding the default graph).

        The returned Stream SHOULD NOT contain duplicate graph names.

        The graph names can be used with Dataset.getGraph(BlankNodeOrIRI) to retrieve the corresponding Graph, however callers should be aware of any concurrent modifications to the Dataset may cause such calls to return Optional.empty().

        Note that a Dataset always contains a default graph which is not named, and thus is not represented in the returned Stream. The default graph is accessible via Dataset.getGraph() or by using Optional.empty() in the Quad access methods).

        Specified by:
        getGraphNames in interface Dataset
        Returns:
        A Stream of the graph names of this Dataset.
      • remove

        public void remove​(java.util.Optional<BlankNodeOrIRI> graphName,
                           BlankNodeOrIRI subject,
                           IRI predicate,
                           RDFTerm object)
        Description copied from interface: Dataset
        Remove a concrete pattern of quads from the default graph of the dataset.
        Specified by:
        remove in interface Dataset
        Overrides:
        remove in class AbstractJsonLdGraphLike<Quad>
        Parameters:
        graphName - The graph the quad belongs to, wrapped as an Optional (null is a wildcard, Optional.empty() is the default graph)
        subject - The quad subject (null is a wildcard)
        predicate - The quad predicate (null is a wildcard)
        object - The quad object (null is a wildcard)
      • remove

        public void remove​(Quad q)
        Description copied from interface: GraphLike
        Add a statement.
        Specified by:
        remove in interface Dataset
        Specified by:
        remove in interface GraphLike<Quad>
        Parameters:
        q - The TripleLike statement to add
      • stream

        public java.util.stream.Stream<? extends Quad> stream​(java.util.Optional<BlankNodeOrIRI> graphName,
                                                              BlankNodeOrIRI subject,
                                                              IRI predicate,
                                                              RDFTerm object)
        Description copied from interface: Dataset
        Get all quads contained by the dataset matched with the pattern.

        The iteration does not contain any duplicate quads, as determined by the Quad.equals(Object) method for each Quad.

        The behaviour of the Stream is not specified if Dataset.add(Quad), Dataset.remove(Quad) or Dataset.clear() are called on the Dataset before it terminates.

        Implementations may throw ConcurrentModificationException from Stream methods if they detect a conflict while the Stream is active.

        Specified by:
        stream in interface Dataset
        Parameters:
        graphName - The graph the quad belongs to, wrapped as an Optional (null is a wildcard, Optional.empty() is the default graph)
        subject - The quad subject (null is a wildcard)
        predicate - The quad predicate (null is a wildcard)
        object - The quad object (null is a wildcard)
        Returns:
        A Stream over the matched quads.
      • size

        public long size()
        Description copied from interface: GraphLike
        Number of statements.
        Specified by:
        size in interface Dataset
        Specified by:
        size in interface GraphLike<Quad>
        Returns:
        Number of statements