Skip to content

Commit b4e174e

Browse files
committed
[doc/rdf] Add CL script description
1 parent 70cc940 commit b4e174e

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

doc/odmltordf.rst

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
=====================
2-
Exporting odML to RDF
3-
=====================
1+
===============================
2+
odML and RDF - Export and usage
3+
===============================
44

5-
Opening odML to the Semantic Web and graph database searches
6-
============================================================
5+
Semantic Web and graph database searches
6+
========================================
77

88
Searches within odML documents are part of the library implementation and imports from linked, external sources into odML documents can be easily done with the core library functionality.
99
With the option to export odML documents to the RDF format, users also gain the option to search across multiple documents using tools from the Semantic Web technology.
@@ -12,16 +12,13 @@ If you are unfamiliar with it, we linked additional information to the `Semantic
1212

1313
RDF was designed by the World Wide Web Consortium (W3C) as a standard model for data representation and exchange on the web with the heterogeneity of data in mind. Even tough the RDF file format might vary, the underlying concept features two key points. The first is that information is structured in subject-predicate-object triples e.g. "apple hasColor red". The second key point is that multiple subjects and objects can be connected to form a graph e.g. "tree hasFruit apple" can be combined with the previous example to form a minimal graph. These graphs can contain very heterogeneous data, but can still be queried due to the semantic structure of the underlying data.
1414

15-
odML to RDF usage
16-
=================
15+
odML to RDF export
16+
==================
1717

1818
Without further ado the next sections will expose you to the range of odML to RDF features the core library provides.
1919

20-
Saving an odML document to an RDF format file
21-
---------------------------------------------
22-
23-
Using odml.save to export to default XML RDF
24-
********************************************
20+
Default odML to XML RDF export
21+
------------------------------
2522

2623
Once an odML document is available, it can most easily be exported to RDF by the odml.save feature.
2724

@@ -62,16 +59,17 @@ The content of the file will look something like this (the UUIDs of the individu
6259
</rdf:Description>
6360
</rdf:RDF>
6461

65-
Using the RDFWriter class to export to a specific RDF format
66-
************************************************************
6762

68-
The RDFWriter class is used to convert odML documents to one of the supported RDF formats:
63+
Specific RDF format export
64+
--------------------------
65+
66+
The ``RDFWriter`` class is used to convert odML documents to one of the supported RDF formats:
6967

7068
``xml, pretty-xml, trix, n3, turtle, ttl, ntriples, nt, nt11, trig``
7169

72-
``turtle`` is the format that is best suited for storage and human readability which is why we will use it in our tutorial. For cross-tool usage, saving RDF in its ``XML`` variant is probably the safest choice.
70+
``turtle`` is the format that is best suited for storage and human readability while for cross-tool usage, saving RDF in its ``XML`` variant is probably the safest choice.
7371

74-
The output can also be returned as a string instead of saving it to a file::
72+
The exported output can be returned as a string::
7573

7674
from odml.tools.rdf_converter import RDFWriter
7775

@@ -95,10 +93,21 @@ This will print the content of the odML document in the Turtle flavor of RDF::
9593
odml:hasProperty odml:281c5aa7-8fea-4852-85ec-db127f753647 ;
9694
odml:hasType "n.s." .
9795

98-
The output can of course also be written to a file with a specified RDF output format; the output file will autmatically be assigned the appropriate file ending.::
96+
The output can of course also be written to a file with a specified RDF output format; the output file will autmatically be assigned the appropriate file ending::
9997

10098
from odml.tools.rdf_converter import RDFWriter
10199

102100
RDFWriter(doc).write_file("./rdf_export_turtle", "turtle")
103101

104102
All available RDF output formats can be viewed via ``odml.tools.parser_utils.RDF_CONVERSION_FORMATS.keys()``.
103+
104+
Bulk export to XML RDF
105+
----------------------
106+
107+
Existing odML files can be exported to XML RDF in bulk using the ``odmltordf`` command line tool that is automatically installed with the core library.
108+
109+
odmlToRDF searches for odML files within a provided SEARCHDIR and converts them to the newest odML format version and exports all found and resulting odML files to XML formatted RDF. Original files will never be overwritten. New files will be written either to a new directory at the current or a specified location.
110+
111+
Usage: odmltordf [-r] [-o OUT] SEARCHDIR
112+
113+
The command line option ``-r`` enables recursive search, ``-o OUT`` specifies a dedicated output folder for the created output files.

0 commit comments

Comments
 (0)