Package org.wikidata.wdtk.rdf
Class AbstractRdfConverter
java.lang.Object
org.wikidata.wdtk.rdf.AbstractRdfConverter
- Direct Known Subclasses:
RdfConverter
This class provides functions to convert objects of wdtk-datamodel in a rdf
graph.
- Author:
- Michael Günther
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionAbstractRdfConverter
(RdfWriter rdfWriter, Sites sites, PropertyRegister propertyRegister) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Writes all buffered triples and finishes writing a document.static String
getDatatypeIri
(DatatypeIdValue datatype) static org.eclipse.rdf4j.model.Value
getMonolingualTextValueLiteral
(MonolingualTextValue value, RdfWriter rdfWriter) void
Writes OWL declarations for all basic vocabulary elements used in the dump.void
writeClaim
(org.eclipse.rdf4j.model.Resource claimResource, Claim claim) void
writeDocumentTerms
(TermedDocument document) void
writeDocumentType
(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI type) void
writeFullStatement
(Statement statement, boolean best) void
writeInterPropertyLinks
(PropertyDocument document) Writes triples which connect properties with their corresponding rdf properties for statements, simple statements, qualifiers, reference attributes and values.void
writeItemDocument
(ItemDocument document) void
Writes all namespace declarations used in the dump, for examplewikibase:
orschema:
.void
void
writePropertyDatatype
(PropertyDocument document) void
writePropertyDocument
(PropertyDocument document) void
writeReferences
(org.eclipse.rdf4j.model.Resource statementResource, List<? extends Reference> references) void
writeSimpleStatement
(Statement statement) void
writeSiteLinks
(org.eclipse.rdf4j.model.Resource subject, Map<String, SiteLink> siteLinks) void
writeStatement
(Statement statement, boolean best) void
writeStatementRankTriple
(org.eclipse.rdf4j.model.Resource subject, StatementRank rank, boolean best) Writes a triple for theStatementRank
of aStatement
to the dump.void
writeStatements
(StatementDocument statementDocument) void
writeTermTriples
(org.eclipse.rdf4j.model.Resource subject, AbstractRdfConverter.TermKind kind, Collection<MonolingualTextValue> terms)
-
Constructor Details
-
AbstractRdfConverter
-
-
Method Details
-
writeBasicDeclarations
public void writeBasicDeclarations() throws org.eclipse.rdf4j.rio.RDFHandlerExceptionWrites OWL declarations for all basic vocabulary elements used in the dump. Example of the triples written by this method:wikibase:propertyType rdf:type owl:ObjectProperty
- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeNamespaceDeclarations
public void writeNamespaceDeclarations() throws org.eclipse.rdf4j.rio.RDFHandlerExceptionWrites all namespace declarations used in the dump, for examplewikibase:
orschema:
.- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
finishDocument
public void finishDocument() throws org.eclipse.rdf4j.rio.RDFHandlerExceptionWrites all buffered triples and finishes writing a document. This will take care of writing auxiliary triples that got buffered during serialization, such as OWL declarations, references and auxiliary triples for complex values.- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeOWLDeclarations
public void writeOWLDeclarations() -
writeDocumentType
public void writeDocumentType(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI type) -
writeItemDocument
public void writeItemDocument(ItemDocument document) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writePropertyDatatype
-
writePropertyDocument
public void writePropertyDocument(PropertyDocument document) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeInterPropertyLinks
public void writeInterPropertyLinks(PropertyDocument document) throws org.eclipse.rdf4j.rio.RDFHandlerException Writes triples which connect properties with their corresponding rdf properties for statements, simple statements, qualifiers, reference attributes and values.- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeDocumentTerms
public void writeDocumentTerms(TermedDocument document) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeTermTriples
public void writeTermTriples(org.eclipse.rdf4j.model.Resource subject, AbstractRdfConverter.TermKind kind, Collection<MonolingualTextValue> terms) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeStatements
public void writeStatements(StatementDocument statementDocument) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeStatement
public void writeStatement(Statement statement, boolean best) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeFullStatement
public void writeFullStatement(Statement statement, boolean best) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeSimpleStatement
-
writeStatementRankTriple
public void writeStatementRankTriple(org.eclipse.rdf4j.model.Resource subject, StatementRank rank, boolean best) Writes a triple for theStatementRank
of aStatement
to the dump. If this is a best-rank statement, also writes a best rank triple.- Parameters:
subject
- The IRI of the statementrank
- The rank of the statementbest
- True if this statement is a best-rank statement
-
writeReferences
public void writeReferences(org.eclipse.rdf4j.model.Resource statementResource, List<? extends Reference> references) throws org.eclipse.rdf4j.rio.RDFHandlerException - Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
writeClaim
-
writeSiteLinks
public void writeSiteLinks(org.eclipse.rdf4j.model.Resource subject, Map<String, SiteLink> siteLinks) throws org.eclipse.rdf4j.rio.RDFHandlerException- Throws:
org.eclipse.rdf4j.rio.RDFHandlerException
-
getMonolingualTextValueLiteral
public static org.eclipse.rdf4j.model.Value getMonolingualTextValueLiteral(MonolingualTextValue value, RdfWriter rdfWriter) -
getDatatypeIri
-