Class RDFSource

java.lang.Object
com.inrupt.rdf.wrapping.commons.WrapperDataset
com.inrupt.client.RDFSource
All Implemented Interfaces:
Resource, AutoCloseable, org.apache.commons.rdf.api.Dataset, org.apache.commons.rdf.api.GraphLike<org.apache.commons.rdf.api.Quad>
Direct Known Subclasses:
SolidRDFSource, WebIdProfile

public class RDFSource extends com.inrupt.rdf.wrapping.commons.WrapperDataset implements Resource
A base class for RDF-based resource mapping.

This class can be used as a basis for object mapping with higher-level client applications.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final org.apache.commons.rdf.api.RDF
    The RDF Factory instance.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    RDFSource(URI identifier, org.apache.commons.rdf.api.Dataset dataset)
    Create a new RDF-bearing resource.
    protected
    RDFSource(URI identifier, org.apache.commons.rdf.api.Dataset dataset, Headers headers)
    Create a new RDF-bearing resource.
    protected
    RDFSource(URI identifier, org.apache.commons.rdf.api.RDFSyntax syntax, org.apache.commons.rdf.api.Dataset dataset)
    Create a new RDF-bearing resource.
    protected
    RDFSource(URI identifier, org.apache.commons.rdf.api.RDFSyntax syntax, org.apache.commons.rdf.api.Dataset dataset, Headers headers)
    Create a new RDF-bearing resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    The content type of the resource.
    The resource entity.
    The resource headers.
    The resource identifier.
    void
    serialize(org.apache.commons.rdf.api.RDFSyntax syntax, OutputStream out)
    Serialize this object with a defined RDF syntax.
    Validate the dataset for this object.

    Methods inherited from class com.inrupt.rdf.wrapping.commons.WrapperDataset

    add, add, clear, contains, contains, getGraph, getGraph, getGraphNames, remove, remove, size, stream, stream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.commons.rdf.api.Dataset

    iterate, iterate
  • Field Details

    • rdf

      protected static final org.apache.commons.rdf.api.RDF rdf
      The RDF Factory instance.
  • Constructor Details

    • RDFSource

      protected RDFSource(URI identifier, org.apache.commons.rdf.api.Dataset dataset)
      Create a new RDF-bearing resource.

      Subclasses should have the same constructor signature to work with the provided object mapping mechanism.

      Parameters:
      identifier - the resource identifier
      dataset - the dataset corresponding to this resource, may be null
    • RDFSource

      protected RDFSource(URI identifier, org.apache.commons.rdf.api.Dataset dataset, Headers headers)
      Create a new RDF-bearing resource.

      Subclasses should have the same constructor signature to work with the provided object mapping mechanism.

      Parameters:
      identifier - the resource identifier
      dataset - the dataset corresponding to this resource, may be null
      headers - header values associated with the resource, may be null
    • RDFSource

      protected RDFSource(URI identifier, org.apache.commons.rdf.api.RDFSyntax syntax, org.apache.commons.rdf.api.Dataset dataset)
      Create a new RDF-bearing resource.

      Subclasses should have the same constructor signature to work with the provided object mapping mechanism.

      Parameters:
      identifier - the resource identifier
      syntax - the original RDF syntax in use
      dataset - the dataset corresponding to this resource, may be null
    • RDFSource

      protected RDFSource(URI identifier, org.apache.commons.rdf.api.RDFSyntax syntax, org.apache.commons.rdf.api.Dataset dataset, Headers headers)
      Create a new RDF-bearing resource.

      Subclasses should have the same constructor signature to work with the provided object mapping mechanism.

      Parameters:
      identifier - the resource identifier
      syntax - the original RDF syntax in use
      dataset - the dataset corresponding to this resource, may be null
      headers - header values associated with the resource, may be null
  • Method Details

    • getIdentifier

      public URI getIdentifier()
      Description copied from interface: Resource
      The resource identifier.
      Specified by:
      getIdentifier in interface Resource
      Returns:
      the identifier
    • getContentType

      public String getContentType()
      Description copied from interface: Resource
      The content type of the resource.
      Specified by:
      getContentType in interface Resource
      Returns:
      the content type
    • getHeaders

      public Headers getHeaders()
      Description copied from interface: Resource
      The resource headers.
      Specified by:
      getHeaders in interface Resource
      Returns:
      the resource headers
    • getEntity

      public InputStream getEntity() throws IOException
      Description copied from interface: Resource
      The resource entity.
      Specified by:
      getEntity in interface Resource
      Returns:
      the resource entity
      Throws:
      IOException - in the case of an error when generating the entity
    • serialize

      public void serialize(org.apache.commons.rdf.api.RDFSyntax syntax, OutputStream out) throws IOException
      Serialize this object with a defined RDF syntax.
      Parameters:
      syntax - the RDF syntax
      out - the output stream
      Throws:
      IOException - in the case of an I/O error
    • validate

      public ValidationResult validate()
      Validate the dataset for this object.

      Subclasses may override this method to perform validation on the provided dataset. By default, this method is a no-op.

      Returns:
      the validation result
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.commons.rdf.api.Dataset