Package org.wikidata.wdtk.rdf
Class ReferenceRdfConverter
java.lang.Object
org.wikidata.wdtk.rdf.ReferenceRdfConverter
This class supports the conversion of references to RDF. It buffers
references to avoid duplicates and to allow reference triples to be
serialized separately (for more efficient encodings in syntaxes like Turtle
or RDF/XML).
- Author:
- Markus Kroetzsch
-
Constructor Summary
ConstructorDescriptionReferenceRdfConverter
(RdfWriter rdfWriter, SnakRdfConverter snakRdfConverter, String siteUri) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.rdf4j.model.Resource
addReference
(Reference reference) Adds the given reference to the list of references that should still be serialized, and returns the RDF resource that will be used as a subject.void
Writes references that have been added recently.
-
Constructor Details
-
ReferenceRdfConverter
public ReferenceRdfConverter(RdfWriter rdfWriter, SnakRdfConverter snakRdfConverter, String siteUri) Constructor.- Parameters:
rdfWriter
- object to use for constructing URI objectssnakRdfConverter
- object to use for writing snakssiteUri
- URI prefix that is used by the processed site
-
-
Method Details
-
addReference
Adds the given reference to the list of references that should still be serialized, and returns the RDF resource that will be used as a subject.- Parameters:
reference
- the reference to be serialized- Returns:
- RDF resource that represents this reference
-
writeReferences
public void writeReferences() throws org.eclipse.rdf4j.rio.RDFHandlerExceptionWrites references that have been added recently. Auxiliary triples that are generated for serializing snaks in references will be written right afterwards. This will also trigger any other auxiliary triples to be written that the snak converter object may have buffered.- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
- if there was a problem writing the restrictions
-