public class SnakRdfConverter extends Object implements SnakVisitor<Void>
writeSnak(Snak, Resource, PropertyContext)
. Alternatively, one
can use setSnakContext(Resource, PropertyContext)
and use the class
as a visitor. SomeValueSnak
and NoValueSnak
require further
RDF triples to be written; the same is true for some complex data values that
might be used with ValueSnak
. In such cases, the class stores the
values to a buffer. Methods for writing additional triples for these buffered
values can be called later.Constructor and Description |
---|
SnakRdfConverter(RdfWriter rdfWriter,
OwlDeclarationBuffer owlDeclarationBuffer,
PropertyRegister propertyRegister,
AnyValueConverter valueRdfConverter) |
Modifier and Type | Method and Description |
---|---|
void |
setSnakContext(org.eclipse.rdf4j.model.Resource subject,
PropertyContext propertyContext)
Sets the context in which snaks should be used.
|
Void |
visit(NoValueSnak snak)
Visits a NoValueSnak and returns a result.
|
Void |
visit(SomeValueSnak snak)
Visits a SomeValueSnak and returns a result.
|
Void |
visit(ValueSnak snak)
Visits a ValueSnak and returns a result.
|
void |
writeAuxiliaryTriples()
Writes all auxiliary triples that have been buffered recently.
|
void |
writeSnak(Snak snak,
org.eclipse.rdf4j.model.Resource subject,
PropertyContext propertyContext)
Writes the given snak for the given subject.
|
public SnakRdfConverter(RdfWriter rdfWriter, OwlDeclarationBuffer owlDeclarationBuffer, PropertyRegister propertyRegister, AnyValueConverter valueRdfConverter)
public void writeSnak(Snak snak, org.eclipse.rdf4j.model.Resource subject, PropertyContext propertyContext)
writeAuxiliaryTriples()
needs to be called to serialize this
additional data later on.snak
- the snake to writesubject
- the resource that should be used as a subject of the serialied
triplespropertyContext
- the context in which the snak is usedpublic void setSnakContext(org.eclipse.rdf4j.model.Resource subject, PropertyContext propertyContext)
SnakVisitor
.subject
- the resource that should be used as a subject of the serialied
triplespropertyContext
- the context in which the snaks that are to be converted are
usedpublic Void visit(ValueSnak snak)
SnakVisitor
visit
in interface SnakVisitor<Void>
snak
- the snak to visitpublic Void visit(SomeValueSnak snak)
SnakVisitor
visit
in interface SnakVisitor<Void>
snak
- the snak to visitpublic Void visit(NoValueSnak snak)
SnakVisitor
visit
in interface SnakVisitor<Void>
snak
- the snak to visitpublic void writeAuxiliaryTriples() throws org.eclipse.rdf4j.rio.RDFHandlerException
org.eclipse.rdf4j.rio.RDFHandlerException
- if there was a problem writing the RDF triplesCopyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage