Class ReferenceRdfConverter

java.lang.Object
org.wikidata.wdtk.rdf.ReferenceRdfConverter

public class ReferenceRdfConverter extends Object
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 Details

    • ReferenceRdfConverter

      public ReferenceRdfConverter(RdfWriter rdfWriter, SnakRdfConverter snakRdfConverter, String siteUri)
      Constructor.
      Parameters:
      rdfWriter - object to use for constructing URI objects
      snakRdfConverter - object to use for writing snaks
      siteUri - URI prefix that is used by the processed site
  • Method Details

    • addReference

      public org.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.
      Parameters:
      reference - the reference to be serialized
      Returns:
      RDF resource that represents this reference
    • writeReferences

      public void writeReferences() throws org.eclipse.rdf4j.rio.RDFHandlerException
      Writes 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