|
1 |
| -================== |
2 |
| -odML to RDF export |
3 |
| -================== |
| 1 | +===================== |
| 2 | +Exporting odML to RDF |
| 3 | +===================== |
4 | 4 |
|
5 |
| -Opening odML to graph database searches |
6 |
| -======================================= |
| 5 | +Opening odML to the Semantic Web and graph database searches |
| 6 | +============================================================ |
7 | 7 |
|
8 |
| -Searches within odML documents are part of the library implementation and imports from linked, external sources into odML documents are possible. |
| 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 a brief 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 |
|
| 15 | +odML to RDF usage |
| 16 | +================= |
15 | 17 |
|
| 18 | +Without further ado the next sections will expose you to the range of odML to RDF features the core library provides. |
| 19 | + |
| 20 | +Saving an odML document to an RDF format file |
| 21 | +--------------------------------------------- |
| 22 | + |
| 23 | +Using odml.save to export to default XML RDF |
| 24 | +******************************************** |
| 25 | + |
| 26 | +Once an odML document is available, it can most easily be exported to RDF by the odml.save feature. |
| 27 | + |
| 28 | +Given below is a minimal example:: |
| 29 | + |
| 30 | + import odml |
| 31 | + |
| 32 | + doc = odml.Document() |
| 33 | + sec = odml.Section(name="rdf_export_section", parent=doc) |
| 34 | + prop = odml.Property(name="rdf_export_property", parent=sec) |
| 35 | + |
| 36 | + odml.save(doc, "./rdf_export", "RDF") |
| 37 | + |
| 38 | +This will export the odML document to the RDF format in the XML flavor and will save it to the file `./rdf_export.RDF`. |
| 39 | +The content of the file will look something like this (the UUIDs of the individual nodes will differ):: |
| 40 | + |
| 41 | + <?xml version="1.0" encoding="UTF-8"?> |
| 42 | + <rdf:RDF |
| 43 | + xmlns:odml="https://g-node.org/odml-rdf#" |
| 44 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
| 45 | + <rdf:Description rdf:about="https://g-node.org/odml-rdf#281c5aa7-8fea-4852-85ec-db127f753647"> |
| 46 | + <odml:hasName>rdf_export_property</odml:hasName> |
| 47 | + <rdf:type rdf:resource="https://g-node.org/odml-rdf#Property"/> |
| 48 | + </rdf:Description> |
| 49 | + <rdf:Description rdf:about="https://g-node.org/odml-rdf#08c6e31a-533f-443b-acd2-8e961215d38e"> |
| 50 | + <odml:hasSection rdf:resource="https://g-node.org/odml-rdf#eebe4bf7-af10-4321-87ec-2cdf77289478"/> |
| 51 | + <odml:hasFileName>None</odml:hasFileName> |
| 52 | + <rdf:type rdf:resource="https://g-node.org/odml-rdf#Document"/> |
| 53 | + </rdf:Description> |
| 54 | + <rdf:Description rdf:about="https://g-node.org/odml-rdf#eebe4bf7-af10-4321-87ec-2cdf77289478"> |
| 55 | + <odml:hasName>rdf_export_section</odml:hasName> |
| 56 | + <odml:hasType>n.s.</odml:hasType> |
| 57 | + <odml:hasProperty rdf:resource="https://g-node.org/odml-rdf#281c5aa7-8fea-4852-85ec-db127f753647"/> |
| 58 | + <rdf:type rdf:resource="https://g-node.org/odml-rdf#Section"/> |
| 59 | + </rdf:Description> |
| 60 | + <rdf:Description rdf:about="https://g-node.org/odml-rdf#Hub"> |
| 61 | + <odml:hasDocument rdf:resource="https://g-node.org/odml-rdf#08c6e31a-533f-443b-acd2-8e961215d38e"/> |
| 62 | + </rdf:Description> |
| 63 | + </rdf:RDF> |
0 commit comments