Package com.inrupt.client
Class RDFSource
- java.lang.Object
-
- com.inrupt.rdf.wrapping.commons.WrapperDataset
-
- com.inrupt.client.RDFSource
-
- All Implemented Interfaces:
Resource
,AutoCloseable
,Dataset
,GraphLike<Quad>
- Direct Known Subclasses:
SolidRDFSource
,WebIdProfile
public class RDFSource extends 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
String
getContentType()
The content type of the resource.InputStream
getEntity()
The resource entity.URI
getIdentifier()
The resource identifier.void
serialize(RDFSyntax syntax, OutputStream out)
Serialize this object with a defined RDF syntax.ValidationResult
validate()
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
-
-
-
-
Field Detail
-
rdf
protected static final RDF rdf
The RDF Factory instance.
-
-
Constructor Detail
-
RDFSource
protected RDFSource(URI identifier, 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 identifierdataset
- the dataset corresponding to this resource, may benull
-
RDFSource
protected RDFSource(URI identifier, RDFSyntax syntax, 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 identifiersyntax
- the original RDF syntax in usedataset
- the dataset corresponding to this resource, may benull
-
-
Method Detail
-
getIdentifier
public URI getIdentifier()
Description copied from interface:Resource
The resource identifier.- Specified by:
getIdentifier
in interfaceResource
- Returns:
- the identifier
-
getContentType
public String getContentType()
Description copied from interface:Resource
The content type of the resource.- Specified by:
getContentType
in interfaceResource
- Returns:
- the content type
-
getEntity
public InputStream getEntity() throws IOException
Description copied from interface:Resource
The resource entity.- Specified by:
getEntity
in interfaceResource
- Returns:
- the resource entity
- Throws:
IOException
- in the case of an error when generating the entity
-
serialize
public void serialize(RDFSyntax syntax, OutputStream out) throws IOException
Serialize this object with a defined RDF syntax.- Parameters:
syntax
- the RDF syntaxout
- 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 interfaceAutoCloseable
- Specified by:
close
in interfaceDataset
-
-