You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/odmltordf.rst
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Opening odML to the Semantic Web and graph database searches
8
8
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.
9
9
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.
10
10
11
-
If you are unfamiliar with it, we linked additional information to the `Semantic web<https://www.w3.org/standards/semanticweb>`_ and `RDF<https://www.w3.org/TR/rdf11-concepts>`_ for your convenience and give the briefest introduction below.
11
+
If you are unfamiliar with it, we linked additional information to the `Semantic web<https://www.w3.org/standards/semanticweb>`_ and `RDF<https://www.w3.org/TR/rdf11-concepts>`_ for your convenience and give the briefest introduction below.
12
12
13
13
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.
14
14
@@ -61,3 +61,44 @@ The content of the file will look something like this (the UUIDs of the individu
``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.
73
+
74
+
The output can also be returned as a string instead of saving it to a file::
75
+
76
+
from odml.tools.rdf_converter import RDFWriter
77
+
78
+
print(RDFWriter(doc).get_rdf_str('turtle'))
79
+
80
+
This will print the content of the odML document in the Turtle flavor of RDF::
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.::
0 commit comments