[tracker/sam/ontology-docs] Rework the Ontology documentation



commit 46d8b440ba1000ac332c44419b473ce3c44f2a73
Author: Sam Thursfield <sam afuera me uk>
Date:   Thu Apr 9 01:45:54 2020 +0200

    Rework the Ontology documentation
    
    This change was motivated by https://gitlab.gnome.org/GNOME/tracker/issues/104.
    We want to move to using URLs that we control for the ontologies, like
    this:
    
            http://api.gnome.org/ontologies/nfo/3.0/#Document
            http://api.gnome.org/ontologies/nfo/3.0/#url
    
    For this scheme to work, each ontology needs to document all classes
    and properties on a single page.
    
    It's an opportunity to reorganize the documentation too and try to
    prioritize the most important info. Here's a partial list of
    changes in this commit:
    
      * One page per ontology, listing all classes and properties defined
        in that ontology.
      * URL fragments matching class and property names, so for example
        /nmm.html#artistName links to the nmm:artistName property.
      * Cross references now work between libtracker-sparql3 and
        tracker3-nepomuk ontology docs
      * Properties are shown as a concise table.
      * Classes and properties are listed in alphabetical order.
      * New 'tracker:specification' property which allows us to link
        to upstream documentation.
      * New 'synopsis' section for each ontology showing appropriate Turtle
        @prefix statement
    
    Also, the `docs/tools/ttl2xml` program now returns failed status
    when it encounters parse errors in an ontology.

 docs/reference/images/icon-deprecated.svg      |  71 +++++
 docs/reference/images/icon-fulltextindexed.svg |   1 +
 docs/reference/images/icon-multivalue.svg      |  70 +++++
 docs/reference/images/icon-notify.svg          |   1 +
 docs/reference/images/icon-superproperty.svg   |   3 +
 docs/reference/libtracker-sparql/meson.build   |   1 +
 docs/reference/meson.build                     |   8 +
 docs/reference/ontology/meson.build            |   2 +
 docs/reference/ontology/mfo-introduction.xml   |   6 +-
 docs/reference/ontology/mlo-introduction.xml   |  16 +-
 docs/reference/ontology/nco-introduction.xml   |   2 +-
 docs/reference/ontology/nie-introduction.xml   |  30 +-
 docs/reference/ontology/nmm-introduction.xml   |  20 +-
 docs/reference/ontology/nmo-introduction.xml   |  22 +-
 docs/reference/ontology/xsd-introduction.xml   |  16 --
 docs/tools/ttl2xml.c                           |  28 +-
 docs/tools/ttl_loader.c                        |  69 +++--
 docs/tools/ttl_loader.h                        |   5 +-
 docs/tools/ttl_model.c                         |  21 ++
 docs/tools/ttl_model.h                         |   4 +
 docs/tools/ttl_xml.c                           | 263 +++++++++++++++---
 docs/tools/ttlresource2xml.c                   | 370 ++++++++++++-------------
 docs/tools/ttlresource2xml.h                   |  10 +-
 src/libtracker-data/tracker-turtle-reader.c    |   8 +
 src/libtracker-data/tracker-turtle-reader.h    |   2 +
 src/ontologies/10-xsd.ontology                 |  24 +-
 src/ontologies/11-rdf.ontology                 |  45 ++-
 27 files changed, 743 insertions(+), 375 deletions(-)
---
diff --git a/docs/reference/images/icon-deprecated.svg b/docs/reference/images/icon-deprecated.svg
new file mode 100644
index 000000000..23ed33b17
--- /dev/null
+++ b/docs/reference/images/icon-deprecated.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb";
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   width="16"
+   viewBox="0 0 16 16"
+   version="1.1"
+   id="svg7384"
+   height="16">
+  <metadata
+     id="metadata90">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <title
+     id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs
+     id="defs7386">
+    <linearGradient
+       osb:paint="solid"
+       id="linearGradient7212">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop7214" />
+    </linearGradient>
+  </defs>
+  <g
+     transform="translate(-39.9997,39.98872)"
+     style="display:inline"
+     id="layer1" />
+  <g
+     transform="translate(-280.9999,406.98872)"
+     style="display:inline"
+     id="layer9" />
+  <g
+     transform="translate(-280.9999,406.98872)"
+     style="display:inline"
+     id="g7628" />
+  <g
+     transform="translate(-39.9997,39.98872)"
+     style="display:inline"
+     id="g6387" />
+  <g
+     transform="translate(-39.9997,39.98872)"
+     style="display:inline"
+     id="layer10" />
+  <g
+     transform="translate(-39.9997,39.98872)"
+     id="layer12">
+    <path
+       d="m 47.90615,-39.89497 c -0.5255,-0.0286 -1.03823,0.28305 -1.4375,0.96875 l -6.25,11.59375 c 
-0.53347,0.96339 0.04822,2.34375 1.09375,2.34375 h 13.15625 c 0.98172,0 1.90311,-1.15939 1.21875,-2.34375 l 
-6.3125,-11.53125 c -0.39872,-0.64617 -0.94325,-1.00262 -1.46875,-1.03125 z m 0.0625,3.9375 c 0.54448,-0.0172 
1.04849,0.48677 1.03125,1.03125 v 3.9375 c 0.007,0.52831 -0.47163,1 -1,1 -0.52836,0 -1.00747,-0.47169 -1,-1 v 
-3.9375 c -0.008,-0.4666 0.3541,-0.91253 0.8125,-1 0.0511,-0.0145 0.10345,-0.02495 0.15625,-0.03125 z m 
0.03125,6.96875 c 0.552285,0 1,0.447715 1,1 0,0.552285 -0.447715,1 -1,1 -0.552285,0 -1,-0.447715 -1,-1 
0,-0.552285 0.447715,-1 1,-1 z"
+       id="path18112"
+       
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;enable-background:new"
 />
+  </g>
+  <g
+     transform="translate(-39.9997,39.98872)"
+     style="display:inline"
+     id="layer11" />
+</svg>
diff --git a/docs/reference/images/icon-fulltextindexed.svg b/docs/reference/images/icon-fulltextindexed.svg
new file mode 100644
index 000000000..912fe3ff0
--- /dev/null
+++ b/docs/reference/images/icon-fulltextindexed.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; width="16" height="16"><g color="#000" font-weight="400" 
font-family="sans-serif" fill="#474747"><path d="M6.508 1C3.48 1 1.002 3.473 1.002 6.5c0 3.026 2.478 5.5 
5.506 5.5s5.504-2.474 5.504-5.5c0-3.027-2.476-5.5-5.504-5.5zm0 2a3.486 3.486 0 013.504 3.5c0 1.944-1.556 
3.5-3.504 3.5a3.488 3.488 0 01-3.506-3.5C3.002 4.555 4.56 3 6.508 3z" 
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none"
 overflow="visible"/><path d="M10 8.99a1 1 0 00-.695 1.717l4.004 4a1 1 0 101.414-1.414l-4.004-4A1 1 0 0010 
8.99z" style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;fon
 
t-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none"
 overflow="visible"/></g></svg>
\ No newline at end of file
diff --git a/docs/reference/images/icon-multivalue.svg b/docs/reference/images/icon-multivalue.svg
new file mode 100644
index 000000000..5990d7521
--- /dev/null
+++ b/docs/reference/images/icon-multivalue.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb";
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   width="16"
+   viewBox="0 0 16 16.03899"
+   version="1.1"
+   id="svg7384"
+   height="16.03899">
+  <metadata
+     id="metadata90">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <title
+     id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs
+     id="defs7386">
+    <linearGradient
+       osb:paint="solid"
+       id="linearGradient7212">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop7214" />
+    </linearGradient>
+  </defs>
+  <g
+     transform="translate(-320.98275,227.01492)"
+     style="display:inline"
+     id="layer9">
+    <path
+       id="rect3806"
+       d="m 324.17969,-227.01562 c -1.2016,0 -2.19727,1.00124 -2.19727,2.20117 V -224 h 2 v -0.81445 c 
0,-0.1309 0.0735,-0.20117 0.19727,-0.20117 h 9.60742 c 0.12378,0 0.19531,0.0703 0.19531,0.20117 V -224 h 2 v 
-0.81445 c 0,-1.19993 -0.99372,-2.20117 -2.19531,-2.20117 z"
+       
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.
 
99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
 />
+    <path
+       id="path3848"
+       d="m 324.17969,-215.00781 c -1.2016,0 -2.19727,1.00124 -2.19727,2.20117 v 1.83008 h 2 v -1.83008 c 
0,-0.13089 0.0735,-0.20117 0.19727,-0.20117 h 9.60742 c 0.12378,0 0.19531,0.0703 0.19531,0.20117 v 1.78711 h 
2 v -1.78711 c 0,-1.19993 -0.99372,-2.20117 -2.19531,-2.20117 z"
+       
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.
 
99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
 />
+    <path
+       id="path3856"
+       d="m 324.17969,-223.01562 c -1.2016,0 -2.19727,1.00124 -2.19727,2.20117 V -220 h 2 v -0.81445 c 
0,-0.1309 0.0735,-0.20117 0.19727,-0.20117 h 9.60742 c 0.12378,0 0.19531,0.0703 0.19531,0.20117 V -220 h 2 v 
-0.81445 c 0,-1.19993 -0.99372,-2.20117 -2.19531,-2.20117 z"
+       
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.
 
99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
 />
+    <path
+       id="path3858"
+       d="m 324.17969,-219.01562 c -1.2016,0 -2.19727,1.00124 -2.19727,2.20117 V -216 h 2 v -0.81445 c 
0,-0.1309 0.0735,-0.20117 0.19727,-0.20117 h 9.60742 c 0.12378,0 0.19531,0.0703 0.19531,0.20117 V -216 h 2 v 
-0.81445 c 0,-1.19993 -0.99372,-2.20117 -2.19531,-2.20117 z"
+       
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.
 
99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
 />
+  </g>
+  <g
+     transform="translate(-79.98255,-139.98508)"
+     id="layer1" />
+  <g
+     transform="translate(-79.98255,-139.98508)"
+     style="display:inline"
+     id="layer10" />
+  <g
+     transform="translate(-79.98255,-139.98508)"
+     id="g6387" />
+</svg>
diff --git a/docs/reference/images/icon-notify.svg b/docs/reference/images/icon-notify.svg
new file mode 100644
index 000000000..4f6971843
--- /dev/null
+++ b/docs/reference/images/icon-notify.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; width="16" height="16"><path d="M7.942 1.948c-2.209 0-3.33 1.5-4 
4l-1 5c-.108.542-.447 1-1 1v1h12v-1c-.552 0-.891-.458-1-1l-1-5c-.53-2.5-1.79-4-4-4zm.176 12a1.5 1.5 0 001.412 
1 1.5 1.5 0 001.412-1z" style="marker:none" fill="#474747"/></svg>
\ No newline at end of file
diff --git a/docs/reference/images/icon-superproperty.svg b/docs/reference/images/icon-superproperty.svg
new file mode 100644
index 000000000..e07d2b38a
--- /dev/null
+++ b/docs/reference/images/icon-superproperty.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg"; width="16" height="16">
+    <path d="M12 9h-1c-.258 0-.53-.13-.72-.313L9 7.407V16H7V7.406L5.717 
8.687c-.19.183-.462.313-.719.313H4V8c0-.31.09-.552.281-.75L8 3.594l3.718 3.656c.19.198.281.44.281.75z" 
style="line-height:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;white-space:normal"
 color="#000" font-weight="400" font-family="sans-serif" overflow="visible" fill="#2e3436"/>
+</svg>
diff --git a/docs/reference/libtracker-sparql/meson.build b/docs/reference/libtracker-sparql/meson.build
index 29181d8f0..f85a17bce 100644
--- a/docs/reference/libtracker-sparql/meson.build
+++ b/docs/reference/libtracker-sparql/meson.build
@@ -37,6 +37,7 @@ gnome.gtkdoc('libtracker-sparql',
     main_xml: 'libtracker-sparql-docs.xml',
     scan_args: ['--ignore-headers=' + ' '.join(private_headers)],
     content_files: ['overview.xml', 'examples.xml', 'ontologies.xml', 'private-store.xml', 
'migrating-1to2.xml', example_files],
+    html_assets: icon_images,
     gobject_typesfile: 'libtracker-sparql.types',
     dependencies: tracker_sparql_dep,
     fixxref_args: fixxref_args,
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 882344b81..d44f61d20 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -11,6 +11,14 @@ fixxref_args = [
     '--extra-dir=@0@'.format(join_paths(docpath, 'libtracker-sparql')),
 ]
 
+icon_images = files(
+  'images/icon-deprecated.svg',
+  'images/icon-fulltextindexed.svg',
+  'images/icon-multivalue.svg',
+  'images/icon-notify.svg',
+  'images/icon-superproperty.svg',
+)
+
 subdir('libtracker-sparql')
 
 subdir('ontology')
diff --git a/docs/reference/ontology/meson.build b/docs/reference/ontology/meson.build
index b3ab93d79..8c750fadd 100644
--- a/docs/reference/ontology/meson.build
+++ b/docs/reference/ontology/meson.build
@@ -16,5 +16,7 @@ generated = custom_target('ontology-doc-generated',
 gnome.gtkdoc('ontology',
     src_dir: include_directories('.'),
     main_xml: 'ontology-docs.xml',
+    html_assets: icon_images,
+    fixxref_args: fixxref_args,
     install_dir: 'tracker@0@-nepomuk'.format(tracker_api_major),
     install: true)
diff --git a/docs/reference/ontology/mfo-introduction.xml b/docs/reference/ontology/mfo-introduction.xml
index 84a2154a3..236ea0ba2 100644
--- a/docs/reference/ontology/mfo-introduction.xml
+++ b/docs/reference/ontology/mfo-introduction.xml
@@ -7,15 +7,15 @@
 
 <para>The basic assumption in the ontology is that all these feeds are unidirectional conversations with 
(from) the author of the content and every post on those channels is a message.</para>
 
-<para>The source of the posts, the feed itself, is an instance of <link 
linkend="mfo-FeedChannel">mfo:FeedChannel</link>. Each post in that feed will be an instance of <link 
linkend="mfo-FeedMessage">mfo:FeedMessage</link> . The relation between the messages and the channel comes 
from their superclasses, <link linkend="nmo-Message.nmo-communicationChannel">nmo:communicationChannel</link> 
(taking into account that <link linkend="mfo-FeedChannel">mfo:FeedChannel</link> is a subclass of <link 
linkend="nmo-CommunicationChannel">nmo:CommunicationChannel</link> and <link 
linkend="mfo-FeedMessage">mfo:FeedMessage</link> a subclass of <link 
linkend="nmo-Message">nmo:Message</link>).</para>
+<para>The source of the posts, the feed itself, is an instance of <link 
linkend="mfo-FeedChannel">mfo:FeedChannel</link>. Each post in that feed will be an instance of <link 
linkend="mfo-FeedMessage">mfo:FeedMessage</link> . The relation between the messages and the channel comes 
from their superclasses, <link linkend="nmo-communicationChannel">nmo:communicationChannel</link> (taking 
into account that <link linkend="mfo-FeedChannel">mfo:FeedChannel</link> is a subclass of <link 
linkend="nmo-CommunicationChannel">nmo:CommunicationChannel</link> and <link 
linkend="mfo-FeedMessage">mfo:FeedMessage</link> a subclass of <link 
linkend="nmo-Message">nmo:Message</link>).</para>
 
 <para>A post can be plain text but can contain also more things like links, videos or Mp3. We represent 
those internal pieces in instances of <link linkend="mfo-Enclosure">mfo:Enclosure.</link> This class has 
properties to link with the remote and local representation of the resource (in case the content has been 
downloaded).</para>
 
-<para>Finally, the three important classes (mfo:FeedChannel, mfo:FeedMessage, mfo:Enclosure) are subclasses 
of <link linkend="mfo-FeedElement">mfo:FeedElement</link>, just an abstract class to share the link with 
mfo:FeedSettings. <link linkend="mfo-FeedSettings">mfo:FeedSettings</link> contains some common configuration 
options. Not all of them applies to all, but it is a quite cleaner solution. For instance the <link 
linkend="mfo-FeedSettings.mfo-maxSize">mfo:maxSize</link> property only makes sense per-enclosure, while the 
<link linkend="mfo-FeedSettings.mfo-updateInterval">mfo:updateInterval</link> is useful for the 
channel.</para>
+<para>Finally, the three important classes (mfo:FeedChannel, mfo:FeedMessage, mfo:Enclosure) are subclasses 
of <link linkend="mfo-FeedElement">mfo:FeedElement</link>, just an abstract class to share the link with 
mfo:FeedSettings. <link linkend="mfo-FeedSettings">mfo:FeedSettings</link> contains some common configuration 
options. Not all of them applies to all, but it is a quite cleaner solution. For instance the <link 
linkend="mfo-maxSize">mfo:maxSize</link> property only makes sense per-enclosure, while the <link 
linkend="mfo-updateInterval">mfo:updateInterval</link> is useful for the channel.</para>
  </sect2>
 
  <sect2 id="mfo-special-remarks">
   <title>Special remarks</title>
-<para>In some feeds, like <ulink url="http://video.search.yahoo.com/mrss";>"Yahoo Media RSS</ulink>, there 
can be multiple enclosures together in a group, representing the same resource in different formats, 
qualities, resolutions, etc. Until further notify, the group will be represented using <link 
linkend="nie-InformationElement.nie-identifier">nie:identifier</link> property . To mark the default 
enclosure of the group, there is a <link linkend="mfo-Enclosure.mfo-groupDefault">mfo-groupDefault</link> 
property</para>
+<para>In some feeds, like <ulink url="http://video.search.yahoo.com/mrss";>"Yahoo Media RSS</ulink>, there 
can be multiple enclosures together in a group, representing the same resource in different formats, 
qualities, resolutions, etc. Until further notify, the group will be represented using <link 
linkend="nie-identifier">nie:identifier</link> property . To mark the default enclosure of the group, there 
is a <link linkend="mfo-groupDefault">mfo-groupDefault</link> property</para>
  </sect2>
 </section>
diff --git a/docs/reference/ontology/mlo-introduction.xml b/docs/reference/ontology/mlo-introduction.xml
index 2c67715ed..0940da721 100644
--- a/docs/reference/ontology/mlo-introduction.xml
+++ b/docs/reference/ontology/mlo-introduction.xml
@@ -16,29 +16,29 @@
    <orderedlist>
      <listitem>
        <para>
-       As a Box (using the class <link linkend="mlo-GeoBoundingBox">mlo:GeoBoundingBox</link> and the 
property <link linkend="mlo-GeoLocation.mlo-asBoundingBox">mlo:asBoundingBox</link>)
+       As a Box (using the class <link linkend="mlo-GeoBoundingBox">mlo:GeoBoundingBox</link> and the 
property <link linkend="mlo-asBoundingBox">mlo:asBoundingBox</link>)
        </para>
      </listitem>
      <listitem>
        <para>
-      As a point with coordinates (using the class <link linkend="mlo-GeoPoint">mlo:GeoPoint</link> and the 
property <link linkend="mlo-GeoLocation.mlo-asGeoPoint">mlo:asGeoPoint</link>) as a single point in the space 
with its coordinates
+      As a point with coordinates (using the class <link linkend="mlo-GeoPoint">mlo:GeoPoint</link> and the 
property <link linkend="mlo-asGeoPoint">mlo:asGeoPoint</link>) as a single point in the space with its 
coordinates
        </para>
      </listitem>
      <listitem>
        <para>
-       As a postal address, with the text description (using the class <link 
linkend="nco-PostalAddress">nco:PostalAddress</link> from <link linkend="nco-ontology">NCO ontology</link> 
and the property <link linkend="mlo-GeoLocation.mlo-asPostalAddress">mlo:asPostalAddress</link>)
+       As a postal address, with the text description (using the class <link 
linkend="nco-PostalAddress">nco:PostalAddress</link> from <link linkend="nco-ontology">NCO ontology</link> 
and the property <link linkend="mlo-asPostalAddress">mlo:asPostalAddress</link>)
        </para>
      </listitem>
    </orderedlist>
    <para>These three representations are not exclusive, but is responsibility of the applications to keep 
the data consistent.</para>
-   <para>Some places in the space has an special meaning, E.G. premises, buildings or services. This fact is 
represented in the ontology with the class <link linkend="mlo-Landmark">mlo:Landmark</link>. The title and 
description of the Landmark itself can be set using the <link 
linkend="nie-InformationElement">nie:InformationElement</link> properties (<link 
linkend="nie-InformationElement.nie-title">nie:title</link>, <link 
linkend="nie-InformationElement.nie-description">nie:description</link>, ...). A location is linked with a 
landmark with the property <link linkend="nie-InformationElement.mlo-location">mlo:location</link> inherited 
from the superclass Information Element.</para>
-   <para>Landmark can be grouped in categories. For this reason, the ontology provides a property <link 
linkend="mlo-Landmark.mlo-belongsToCategory">mlo:belongsToCategory</link> that links a Landmark with the 
class <link linkend="mlo-LandmarkCategory">mlo:LandmarkCategory</link> . The ontology includes also a 
predefined set of instances, very common an a de-facto standard in the industry.</para>
+   <para>Some places in the space has an special meaning, E.G. premises, buildings or services. This fact is 
represented in the ontology with the class <link linkend="mlo-Landmark">mlo:Landmark</link>. The title and 
description of the Landmark itself can be set using the <link 
linkend="nie-InformationElement">nie:InformationElement</link> properties (<link 
linkend="nie-title">nie:title</link>, <link linkend="nie-description">nie:description</link>, ...). A 
location is linked with a landmark with the property <link linkend="mlo-location">mlo:location</link> 
inherited from the superclass Information Element.</para>
+   <para>Landmark can be grouped in categories. For this reason, the ontology provides a property <link 
linkend="mlo-belongsToCategory">mlo:belongsToCategory</link> that links a Landmark with the class <link 
linkend="mlo-LandmarkCategory">mlo:LandmarkCategory</link> . The ontology includes also a predefined set of 
instances, very common an a de-facto standard in the industry.</para>
  </refsect2>
 
  <refsect2 id="mlo-considerations">
    <title>Considerations</title>
 
-   <para>A <link linkend="mlo-Landmark">mlo:Landmark</link> is linked with its location using the property 
<link linkend="nie-InformationElement.mlo-location">mlo:location</link>, inherited from its superclass <link 
linkend="nie-InformationElement">nie:InformationElement</link>.</para>
+   <para>A <link linkend="mlo-Landmark">mlo:Landmark</link> is linked with its location using the property 
<link linkend="mlo-location">mlo:location</link>, inherited from its superclass <link 
linkend="nie-InformationElement">nie:InformationElement</link>.</para>
 
    <para>All classes in the ontology are subclasses of <link 
linkend="nie-InformationElement">nie:InformationElement</link>. It is not indicated in the graphic for the 
sake of clarity.</para>
 
@@ -51,8 +51,8 @@
 
    <para>We want to put special emphasis in the point that the applications must keep the different 
representations of the points consistent. Basically a point in the space is very unlikely to change (the 
point is there or not), but it is not difficult to assume that some application can complete the information, 
taking the postal addresses of the points without coordinates, and set the coordinates using some web 
service.</para>
 
-   <para>A box is considered as a <emphasis>2 dimensions</emphasis> area orientated to the north, aligned to 
parallels and meridians. The area is defined with two points: the southern east point (down left corner, in 
the <link linkend="mlo-GeoBoundingBox.mlo-bbSouthEast">mlo:bbSouthEast</link> property) and northern western 
point (upper right corner, in the <link linkend="mlo-GeoBoundingBox.mlo-bbNorthWest">mlo:bbNorthWest</link> 
property).</para>
+   <para>A box is considered as a <emphasis>2 dimensions</emphasis> area orientated to the north, aligned to 
parallels and meridians. The area is defined with two points: the southern east point (down left corner, in 
the <link linkend="mlo-bbSouthEast">mlo:bbSouthEast</link> property) and northern western point (upper right 
corner, in the <link linkend="mlo-bbNorthWest">mlo:bbNorthWest</link> property).</para>
 
-   <para><link linkend="mlo-LandmarkCategory">mlo:LandmarkCategory</link> has a property <link 
linkend="mlo-LandmarkCategory.mlo-isRemovable">mlo:isRemovable</link> to mark is the category is predefined 
and shouldn't be deleted by the applications. Tracker (and probably other backends) doesn't enforce 
applications to respect this value, but consider it a gentleman agreement.</para>
+   <para><link linkend="mlo-LandmarkCategory">mlo:LandmarkCategory</link> has a property <link 
linkend="mlo-isRemovable">mlo:isRemovable</link> to mark is the category is predefined and shouldn't be 
deleted by the applications. Tracker (and probably other backends) doesn't enforce applications to respect 
this value, but consider it a gentleman agreement.</para>
  </refsect2>
 </section>
diff --git a/docs/reference/ontology/nco-introduction.xml b/docs/reference/ontology/nco-introduction.xml
index 8a295531e..b60e6f451 100644
--- a/docs/reference/ontology/nco-introduction.xml
+++ b/docs/reference/ontology/nco-introduction.xml
@@ -29,7 +29,7 @@
  <refsect2 id="nco-PostalAddressRepresentation">
    <title>Postal Address</title>
 
-   <para>Postal address class <link linkend="nco-PostalAddress">nco:PostalAddress</link> represents a point 
in the space defined by the usual street, number, postal code textual data. Most of its parameters come from 
the RFC 2426 section 3.2.1 with few extensions for more granular APIs (<link 
linkend="nco-PostalAddress.nco-county">nco:county</link> and <link 
linkend="nco-PostalAddress.nco-district">nco:district</link>)</para>
+   <para>Postal address class <link linkend="nco-PostalAddress">nco:PostalAddress</link> represents a point 
in the space defined by the usual street, number, postal code textual data. Most of its parameters come from 
the RFC 2426 section 3.2.1 with few extensions for more granular APIs (<link 
linkend="nco-county">nco:county</link> and <link linkend="nco-district">nco:district</link>)</para>
  </refsect2>
 
   <refsect2 id="nco-ImContactsRepresentations">
diff --git a/docs/reference/ontology/nie-introduction.xml b/docs/reference/ontology/nie-introduction.xml
index 63fcbcbdc..d1e4e6647 100644
--- a/docs/reference/ontology/nie-introduction.xml
+++ b/docs/reference/ontology/nie-introduction.xml
@@ -23,8 +23,8 @@ ontology.
 
 <para>
 Both sides are linked using the
-property <link linkend="nie-DataObject.nie-interpretedAs">nie:interpretedAs</link> (and its reverse
-<link linkend="nie-InformationElement.nie-isStoredAs">nie:isStoredAs</link>), indicating the correspondence
+property <link linkend="nie-interpretedAs">nie:interpretedAs</link> (and its reverse
+<link linkend="nie-isStoredAs">nie:isStoredAs</link>), indicating the correspondence
 between the physical element and its interpretation. There is also a
 property to
 link <link linkend="nie-InformationElement">nie:InformationElement</link>s,
@@ -42,32 +42,32 @@ its album).
   </para>
   <variablelist>
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-title">nie:title</link></term>
+      <term><link linkend="nie-title">nie:title</link></term>
       <listitem><para>Title or name or short text describing the item</para></listitem>
     </varlistentry>
 
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-description">nie:description</link></term>
+      <term><link linkend="nie-description">nie:description</link></term>
       <listitem><para>More verbose comment about the element</para></listitem>
     </varlistentry>
 
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-language">nie:language</link></term>
+      <term><link linkend="nie-language">nie:language</link></term>
       <listitem><para>To specify the language of the item.</para></listitem>
     </varlistentry>
 
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-plainTextContent">nie:plainTextContent</link></term>
+      <term><link linkend="nie-plainTextContent">nie:plainTextContent</link></term>
       <listitem><para>Just the raw content of the file, if it makes sense as text.</para></listitem>
     </varlistentry>
 
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-generator">nie:generator</link></term>
+      <term><link linkend="nie-generator">nie:generator</link></term>
       <listitem><para>Software/Agent that set/produced the information.</para></listitem>
     </varlistentry>
 
     <varlistentry>
-      <term><link linkend="nie-InformationElement.nie-usageCounter">nie:usageCounter</link></term>
+      <term><link linkend="nie-usageCounter">nie:usageCounter</link></term>
       <listitem><para>Count number of accesses to the information. It can be an
       indicator of relevance for advanced searches</para></listitem>
     </varlistentry>
@@ -79,7 +79,7 @@ its album).
 <para>There are few important dates for the life-cycle of a resource. These dates are properties of the 
nie:InformationElement class, and inherited for its subclasses:</para>
 <variablelist>
   <varlistentry>
-     <term><link 
linkend="nie-InformationElement.nie-informationElementDate">nie:informationElementDate</link></term>
+     <term><link linkend="nie-informationElementDate">nie:informationElementDate</link></term>
      <listitem>
        <para>This is an ''abstract'' property that act as superproperty of
        the other dates. Don't use it directly.</para>
@@ -87,27 +87,27 @@ its album).
   </varlistentry>
 
   <varlistentry>
-    <term><link 
linkend="nie-InformationElement.nie-contentLastModified">nie:contentLastModified</link></term>
+    <term><link linkend="nie-contentLastModified">nie:contentLastModified</link></term>
     <listitem>
       <para>Modification time of a resource. Usually the mtime of a local file, or information from the 
server for online resources.</para>
     </listitem>
   </varlistentry>
 
   <varlistentry>
-    <term><link linkend="nie-InformationElement.nie-contentCreated">nie:contentCreated</link></term>
+    <term><link linkend="nie-contentCreated">nie:contentCreated</link></term>
     <listitem>
       <para>Creation time of the content. If the contents is created by an application, the same application 
should set the value of this property. Note that this property can be undefined for resources in the 
filesystem because the creation time is not available in the most common filesystem formats.</para>
     </listitem>
   </varlistentry>
 
   <varlistentry>
-    <term><link linkend="nie-InformationElement.nie-contentAccessed">nie:contentAccessed</link></term>
+    <term><link linkend="nie-contentAccessed">nie:contentAccessed</link></term>
     <listitem>
       <para>For resources coming from the filesystem, this is the usual access time to the file. For other  
kind of resources (online or virtual), the application accessing it should update its value.</para>
     </listitem>
     </varlistentry>
     <varlistentry>
-      <term><link linkend="nie-DataObject.nie-lastRefreshed">nie:lastRefreshed</link></term>
+      <term><link linkend="nie-lastRefreshed">nie:lastRefreshed</link></term>
       <listitem>
        <para>.</para>
       </listitem>
@@ -123,8 +123,8 @@ its album).
  <listitem>Every file (local or remote) should generate one DataObject instance and an InformationElement 
instance.</listitem>
  <listitem>Even when Data Objects and Information Elements are completely different things, for efficiency 
reasons in Tracker we use the same URI for both of them.</listitem>
  <listitem>The URI will be an autogenerated ID, and the real location of the item (e.g. 
''file://path/to/file.mp3'') is a property of the Data Object</listitem>
- <listitem>Every DataObject must have the property <link linkend="nie-DataObject.nie-url">nie:url</link>, 
that points to the location of the resource, and should be used by any program that wants to access 
it.</listitem>
- <listitem>There is a deprecated property in the ontology: <link 
linkend="nie-InformationElement.nie-isStoredAs">nie:isStoredAs</link> . We discourage its use in the code: in 
the best case it is a loopback to the nie:url value, but in general it can contain any value or not be set at 
all.</listitem>
+ <listitem>Every DataObject must have the property <link linkend="nie-url">nie:url</link>, that points to 
the location of the resource, and should be used by any program that wants to access it.</listitem>
+ <listitem>There is a deprecated property in the ontology: <link 
linkend="nie-isStoredAs">nie:isStoredAs</link> . We discourage its use in the code: in the best case it is a 
loopback to the nie:url value, but in general it can contain any value or not be set at all.</listitem>
 </orderedlist>
 
 <para>Here comes an example, for the image file /home/user/a.jpeg:</para>
diff --git a/docs/reference/ontology/nmm-introduction.xml b/docs/reference/ontology/nmm-introduction.xml
index 51353ee24..e5a789de2 100644
--- a/docs/reference/ontology/nmm-introduction.xml
+++ b/docs/reference/ontology/nmm-introduction.xml
@@ -1,6 +1,6 @@
-<section id="nmm-explanation">
+<refsection id="nmm-overview">
 <title>Overview</title>
-<sect2>
+<refsection>
 <title>Introduction</title>
 
 <para>This ontology extends NIE (Nepomuk Information Element ontology) and NFO (Nepomuk File Ontology) into 
the domains of multimedia, including Images, Videos, Music and Radio, and includes a couple of properties to 
support uPnP sharing.</para>
@@ -8,21 +8,21 @@
 <para>This ontology replaces/complements NID3 and NEXIF. Those ontologies are a direct map of the respective 
metadata standards, which makes very difficult to map cleanly other standards (like gstreamer metadata, mp4, 
ogg, and so on). Besides, those ontologies contain a lot of very low level technical information that is 
useless to the average user of the desktop.</para>
 
 <para>Our approach in NMM is to keep the minimum properties that make sense for the user, and are present in 
all (or almost all) specific metadata formats. A profesional photographer (or musician) who needs more 
fine-grained details for its documents, is free to add also nID3 information or other extensions to the 
ontology.</para>
-</sect2>
+</refsection>
 
-<sect2>
+<refsection>
   <title>Images domain</title>
 
-<para>The core of images in NMM ontology is the class <link linkend="nmm-Photo">nmm:Photo.</link> It is 
(through a long hierarchy) a <link linkend="nie-InformationElement">nie:InformationElement</link>, an 
interpretation of some bytes. It has properties to store the basic information (camera, metering mode, white 
balance, flash), and inherits from <link linkend="nfo-Image">nfo:Image</link> orientation (<link 
linkend="nfo-Image.nfo-orientation">nfo:orientation</link>) and resolution (<link 
linkend="nfo-Image.nfo-verticalResolution">nfo:verticalResolution</link> and <link 
linkend="nfo-Image.nfo-horizontalResolution">nfo:horizontalResolution</link>).</para>
+<para>The core of images in NMM ontology is the class <link linkend="nmm-Photo">nmm:Photo.</link> It is 
(through a long hierarchy) a <link linkend="nie-InformationElement">nie:InformationElement</link>, an 
interpretation of some bytes. It has properties to store the basic information (camera, metering mode, white 
balance, flash), and inherits from <link linkend="nfo-Image">nfo:Image</link> orientation (<link 
linkend="nfo-orientation">nfo:orientation</link>) and resolution (<link 
linkend="nfo-verticalResolution">nfo:verticalResolution</link> and <link 
linkend="nfo-horizontalResolution">nfo:horizontalResolution</link>).</para>
 
 <para>Note that for tags, nie:keywords (from nie:InformationElement) can be used, or the <link 
linkend="nao-ontology">NAO</link> ontology.</para>
-</sect2>
+</refsection>
 
-<sect2>
+<refsection>
   <title>Radio domain</title>
 <para>NMM includes classes and properties to represent analog and digital radio stations. There is a class 
<link linkend="nmm-RadioStation">nmm:RadioStation</link> on the <link 
linkend="nie-InformationElement">nie:InformationElement</link> side of the ontology, representing what the 
user sees about that station (genre via PTY codes, icon, plus title inherited from 
nie:InformationElement)</para>
-<para>A <link linkend="nmm-RadioStation">nmm:RadioStation</link> can have one or more <link 
linkend="nmm-RadioStation.nmm-carrier">nmm:carrier</link> properties representing the different frequencies 
(or links when it is digitial) it can be tuned. This property links the station with <link 
linkend="nfo-MediaStream">nfo:MediaStream</link>, but usually it will point to one of the subclasses: <link 
linkend="nmm-DigitalRadio">nmm:DigitalRadio</link> (if digital) or <link 
linkend="nmm-AnalogRadio">nmm:AnalogRadio</link> (if analog). An analog station has properties as modulation 
and frequency, while the digial station has streaming bitrate, encoding or protocol.</para>
+<para>A <link linkend="nmm-RadioStation">nmm:RadioStation</link> can have one or more <link 
linkend="nmm-carrier">nmm:carrier</link> properties representing the different frequencies (or links when it 
is digitial) it can be tuned. This property links the station with <link 
linkend="nfo-MediaStream">nfo:MediaStream</link>, but usually it will point to one of the subclasses: <link 
linkend="nmm-DigitalRadio">nmm:DigitalRadio</link> (if digital) or <link 
linkend="nmm-AnalogRadio">nmm:AnalogRadio</link> (if analog). An analog station has properties as modulation 
and frequency, while the digial station has streaming bitrate, encoding or protocol.</para>
 <para>Note that nfo:MediaStream refers to a flux of bytes/data, and it is on the <link 
linkend="nie-DataObject">nie:DataObject</link> side of the ontology</para>
 
-</sect2>
-</section>
+</refsection>
+</refsection>
diff --git a/docs/reference/ontology/nmo-introduction.xml b/docs/reference/ontology/nmo-introduction.xml
index 870419e0c..74301c820 100644
--- a/docs/reference/ontology/nmo-introduction.xml
+++ b/docs/reference/ontology/nmo-introduction.xml
@@ -10,13 +10,13 @@
   <sect2 id="nmo-message-core-class">
     <title>The Message class</title>
 
-    <para>The <link linkend="nmo-Message">nmo:Message</link> class is the common superclass for Emails, SMS, 
IM Messages, MMS (in NMO domain) and even Feed messages (defined in <link linkend="mfo-explanation">MFO 
ontology</link>). As such, it has the common properties for a 'Message' as an meaningful item in a 
communication: sender and receiver of the message, sent/received time, status of the message (read, answered 
and so on). It is a subclass of <link linkend="nie-InformationElement">nie:InformationElement</link> and from 
there inherits the <link linkend="nie-InformationElement.nie-plainTextContent">nie:plainTextContent</link> 
property (which, as its name states, contains the text of the message).
+    <para>The <link linkend="nmo-Message">nmo:Message</link> class is the common superclass for Emails, SMS, 
IM Messages, MMS (in NMO domain) and even Feed messages (defined in <link linkend="mfo-explanation">MFO 
ontology</link>). As such, it has the common properties for a 'Message' as an meaningful item in a 
communication: sender and receiver of the message, sent/received time, status of the message (read, answered 
and so on). It is a subclass of <link linkend="nie-InformationElement">nie:InformationElement</link> and from 
there inherits the <link linkend="nie-plainTextContent">nie:plainTextContent</link> property (which, as its 
name states, contains the text of the message).
     </para>
 
     <para>Few considerations from practical point of view:</para>
     <orderedlist>
-      <listitem><para> <link linkend="nmo-Message.nmo-to">nmo:to</link> and <link 
linkend="nmo-Message.nmo-from">nmo:from</link> should be set always, and there is a predefined instance in 
NCO for the "me" contact.</para></listitem>
-      <listitem><para> <link linkend="nmo-Message.nmo-isSent">nmo:isSent</link> should be used to indicate 
the direction of the message. This helps with the performance of queries to build a conversation 
view.</para></listitem>
+      <listitem><para> <link linkend="nmo-to">nmo:to</link> and <link linkend="nmo-from">nmo:from</link> 
should be set always, and there is a predefined instance in NCO for the "me" contact.</para></listitem>
+      <listitem><para> <link linkend="nmo-isSent">nmo:isSent</link> should be used to indicate the direction 
of the message. This helps with the performance of queries to build a conversation view.</para></listitem>
       <listitem><para> Even when there is a <link linkend="nmo-MessageHeader">nmo:MessageHeader</link> class 
that can store any arbitrary pair of key-values, its use must be as limited as possible. It is there to store 
the specific headers in the messages (mainly email) that cannot be completely represented in the ontology. 
Handle those headers in queries is a performance bottleneck that should be avoided in 
general.</para></listitem>
     </orderedlist>
   </sect2>
@@ -24,7 +24,7 @@
   <sect2 id="nmo-conversation-representation">
     <title>Conversations</title>
     <para>The dialog between two contacts could be considered a list of messages sorted by time, but that 
representation is too simplistic. Two contacts can keep a simultaneous communication in two channels (e.g. IM 
and IRC), and the concept of conversation, a communication with a beginning and end is also important to sort 
the information in the UI.</para>
-    <para>The ontology provides a <link linkend="nmo-CommunicationChannel">nmo:CommunicationChannel</link> 
class, which groups all messages between a certain set of contacts (linked via <link 
linkend="nmo-CommunicationChannel.nmo-hasParticipant">nmo:hasParticipant</link> property). The communication 
channel can be transient (an ad-hoc conversation in IM represented in the subclass <link 
linkend="nmo-TransientChannel">nmo:TransientChannel</link>) or permanent (a well-known IRC channel would be 
an instance of <link linkend="nmo-PermanentChannel">nmo:PermanentChannel</link> ). Every time 'me' talks with 
an specific contact, the communication channel should be the same. It identifies somehow the whole list of 
messages between a set of participants.</para>
+    <para>The ontology provides a <link linkend="nmo-CommunicationChannel">nmo:CommunicationChannel</link> 
class, which groups all messages between a certain set of contacts (linked via <link 
linkend="nmo-hasParticipant">nmo:hasParticipant</link> property). The communication channel can be transient 
(an ad-hoc conversation in IM represented in the subclass <link 
linkend="nmo-TransientChannel">nmo:TransientChannel</link>) or permanent (a well-known IRC channel would be 
an instance of <link linkend="nmo-PermanentChannel">nmo:PermanentChannel</link> ). Every time 'me' talks with 
an specific contact, the communication channel should be the same. It identifies somehow the whole list of 
messages between a set of participants.</para>
     <para>There is a second important class, <link linkend="nmo-Conversation">nmo:Conversation</link> to 
group messages delimited in a time frame. Every time a IM dialog is open (e.g. a window talking with a 
certain contact) a new instance of <link linkend="nmo-Conversation">nmo:Conversation</link> is created.</para>
   </sect2>
 
@@ -32,7 +32,7 @@
     <title>Email domain</title>
     <para>The users usually see an Email as a flat Message, with some thread information and maybe 
'attachments' in it, but in fact internally an Email message is a tree with a special root node (the 
envelope) that links to other nodes called MIME parts. This MIME parts can be plain text (for instance the 
content of the email that the user read) or binary blobs (like a document attached to the message). When a 
message is forwarded, the previous envelope (the root node of the original message) becomes just a mime part 
of the forwarded email.</para>
 
-    <para>The ontology represents completely that email tree. The Envelope, root node or more external 
representation of the Email is the basic <link linkend="nmo-Email">nmo:Email</link> class, subclass of 
Message. Every node in the tree is always a <link linkend="nmo-MimePart">nmo:MimePart</link> with the 
required properties to decode the content (mimetype, encoding, boundaries). When the node is internal, then 
it can use the <link linkend="nie-InformationElement.nie-hasPart">nie:hasPart</link> property to link other 
nodes. The leaf nodes can be instances of specific content classes (besides <link 
linkend="nmo-MimePart">nmo:MimePart</link>). For example, an MP3 embedded in an Email, will be represented as 
an instance nmo:MimePart <emphasis>and</emphasis> <link linkend="nmm-MusicPiece">nmm:MusicPiece</link>. 
</para>
+    <para>The ontology represents completely that email tree. The Envelope, root node or more external 
representation of the Email is the basic <link linkend="nmo-Email">nmo:Email</link> class, subclass of 
Message. Every node in the tree is always a <link linkend="nmo-MimePart">nmo:MimePart</link> with the 
required properties to decode the content (mimetype, encoding, boundaries). When the node is internal, then 
it can use the <link linkend="nie-hasPart">nie:hasPart</link> property to link other nodes. The leaf nodes 
can be instances of specific content classes (besides <link linkend="nmo-MimePart">nmo:MimePart</link>). For 
example, an MP3 embedded in an Email, will be represented as an instance nmo:MimePart 
<emphasis>and</emphasis> <link linkend="nmm-MusicPiece">nmm:MusicPiece</link>. </para>
 
     <para>For more detailed (and highly technical) explanation of the email representation in general and 
this example in concrete, please check <ulink 
url="http://live.gnome.org/Tracker/Documentation/Examples/SPARQL/Email";>this wiki page</ulink></para>
   </sect2>
@@ -46,11 +46,11 @@
     </para>
     <itemizedlist>
       <listitem>A <link linkend="nmo-SMSMessage">nmo:SMSMessage</link> instance to represent the message 
itself</listitem>
-      <listitem><link linkend="nmo-Message.nmo-to">nmo:to</link> and <link 
linkend="nmo-Message.nmo-from">nmo:from</link> linking the contacts (one of them "me", the other a 
nco:Contact or even a nco:PersonContact if the software is able to identify him).</listitem>
-      <listitem>For some implementations, is useful to save the original vcards. For that <link 
linkend="nmo-PhoneMessage.nmo-fromVCard">nmo:fromVCard</link> and <link 
linkend="nmo-PhoneMessage.nmo-toVCard">nmo:toVCard</link> properties can be used. Those properties point to 
files in the file system with the vcards</listitem>
-      <listitem><link linkend="nie-InformationElement.nie-plainTextContent">nie:plainTextContent</link> 
inherited from <link linkend="nie-InformationElement">nie:InformationElement</link> for the 
content.</listitem>
-      <listitem>If needed, language and characterSet are inherited from NIE (<link 
linkend="nie-InformationElement.nie-language">nie:language</link>, <link 
linkend="nie-InformationElement.nie-characterSet">nie:characterSet</link>), but there is a specific <link 
linkend="nmo-PhoneMessage.nmo-encoding">nmo:encoding</link> property.</listitem>
-      <listitem>Note that nmo:SMSMessage is a subclass of <link linkend="nmo-Message">nmo:Message</link> and 
inherits all its properties, including <link 
linkend="nmo-Message.nmo-isDeleted">nmo:isDeleted</link></listitem>
+      <listitem><link linkend="nmo-to">nmo:to</link> and <link linkend="nmo-from">nmo:from</link> linking 
the contacts (one of them "me", the other a nco:Contact or even a nco:PersonContact if the software is able 
to identify him).</listitem>
+      <listitem>For some implementations, is useful to save the original vcards. For that <link 
linkend="nmo-fromVCard">nmo:fromVCard</link> and <link linkend="nmo-toVCard">nmo:toVCard</link> properties 
can be used. Those properties point to files in the file system with the vcards</listitem>
+      <listitem><link linkend="nie-plainTextContent">nie:plainTextContent</link> inherited from <link 
linkend="nie-InformationElement">nie:InformationElement</link> for the content.</listitem>
+      <listitem>If needed, language and characterSet are inherited from NIE (<link 
linkend="nie-language">nie:language</link>, <link linkend="nie-characterSet">nie:characterSet</link>), but 
there is a specific <link linkend="nmo-encoding">nmo:encoding</link> property.</listitem>
+      <listitem>Note that nmo:SMSMessage is a subclass of <link linkend="nmo-Message">nmo:Message</link> and 
inherits all its properties, including <link linkend="nmo-isDeleted">nmo:isDeleted</link></listitem>
     </itemizedlist>
 
     <para>Here is an example of an SMS Message in Tracker/Nepomuk: </para>
@@ -84,7 +84,7 @@
 
   <sect2 id="nmo-call-domain">
     <title>Call domain</title>
-    <para>Voice calls are considered messages in the ontology. A call is a communication item between two 
contacts (therefore a Message with to/from properties) with an extra property <link 
linkend="nmo-Call.nmo-duration">nmo:duration</link>. Each call is represented as an instance of <link 
linkend="nmo-Call">nmo:Call</link> class. There is also a <link linkend="nmo-VOIPCall">nmo:VOIPCall</link> 
class (subclass of <link linkend="nmo-Call">nmo:Call</link>) for VOIP communications (e.g. Skype, GTalk,...). 
</para>
+    <para>Voice calls are considered messages in the ontology. A call is a communication item between two 
contacts (therefore a Message with to/from properties) with an extra property <link 
linkend="nmo-duration">nmo:duration</link>. Each call is represented as an instance of <link 
linkend="nmo-Call">nmo:Call</link> class. There is also a <link linkend="nmo-VOIPCall">nmo:VOIPCall</link> 
class (subclass of <link linkend="nmo-Call">nmo:Call</link>) for VOIP communications (e.g. Skype, GTalk,...). 
</para>
   </sect2>
 
 </section>
diff --git a/docs/tools/ttl2xml.c b/docs/tools/ttl2xml.c
index e22b4fef0..7129c1770 100644
--- a/docs/tools/ttl2xml.c
+++ b/docs/tools/ttl2xml.c
@@ -104,11 +104,12 @@ gint
 main (gint argc, gchar **argv)
 {
        GOptionContext *context;
-       Ontology *ontology = NULL;
        OntologyDescription *description = NULL;
        GList *description_files, *l;
        g_autoptr(GFile) ontology_file = NULL, output_file = NULL;
        gchar *path;
+       gboolean success;
+       g_autoptr(GError) error = NULL;
 
        /* Translators: this messagge will apper immediately after the  */
        /* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     */
@@ -146,10 +147,9 @@ main (gint argc, gchar **argv)
        g_mkdir_with_parents (path, 0755);
        g_free (path);
 
-       ontology = ttl_loader_new_ontology ();
-
+       success = TRUE;
        for (l = description_files; l; l = l->next) {
-               Ontology *file_ontology = NULL;
+               Ontology *ontology = NULL;
                g_autoptr(GFile) ttl_file = NULL, ttl_output_file = NULL;
                gchar *filename;
 
@@ -160,23 +160,23 @@ main (gint argc, gchar **argv)
                ttl_output_file = g_file_get_child (output_file, filename);
                g_free (filename);
 
-               file_ontology = ttl_loader_new_ontology ();
+               ontology = ttl_loader_new_ontology ();
+
+               success &= ttl_loader_load_ontology (ontology, ttl_file, &error);
 
-               ttl_loader_load_ontology (ontology, ttl_file);
-               ttl_loader_load_ontology (file_ontology, ttl_file);
-               ttl_loader_load_prefix_from_description (ontology, description);
+               if (error) {
+                       g_printerr ("%s: Turtle parse error: %s\n", g_file_peek_path (ttl_file), 
error->message);
+                       g_clear_error (&error);
+               }
 
-               ttl_xml_print (description, file_ontology, ttl_output_file, description_dir);
+               ttl_xml_print (description, ontology, ttl_output_file, description_dir);
 
-               ttl_loader_free_ontology (file_ontology);
+               ttl_loader_free_ontology (ontology);
                ttl_loader_free_description (description);
        }
        g_list_free_full (description_files, (GDestroyNotify) g_object_unref);
 
-       generate_ontology_class_docs (ontology, output_file);
-
-       ttl_loader_free_ontology (ontology);
        g_option_context_free (context);
 
-       return 0;
+       return !(success);
 }
diff --git a/docs/tools/ttl_loader.c b/docs/tools/ttl_loader.c
index 6cd336d35..941cedbf1 100644
--- a/docs/tools/ttl_loader.c
+++ b/docs/tools/ttl_loader.c
@@ -39,10 +39,10 @@
 
 /* #define TRACKER_NAMESPACE "http://www.tracker-project.org/ontologies/tracker#Namespace"; */
 #define TRACKER_NS "http://www.tracker-project.org/ontologies/tracker#";
+#define TRACKER_SPECIFICATION TRACKER_NS "specification"
 #define TRACKER_NOTIFY TRACKER_NS "notify"
 #define TRACKER_FTS_INDEXED TRACKER_NS "fulltextIndexed"
 #define TRACKER_FTS_WEIGHT TRACKER_NS "weight"
-#define TRACKER_PREFIX TRACKER_NS "prefix"
 #define TRACKER_DEPRECATED TRACKER_NS "deprecated"
 
 /* Ontology description */
@@ -168,12 +168,6 @@ load_in_memory (Ontology    *ontology,
 
                prop->weight = g_strdup (turtle_object);
 
-       } else if (!g_strcmp0 (turtle_predicate, TRACKER_PREFIX)) {
-               /* A tracker:prefix on a tracker:Namespace */
-               g_hash_table_insert (ontology->prefixes,
-                                    g_strdup (turtle_subject),
-                                    g_strdup (turtle_object));
-
        } else if (!g_strcmp0 (turtle_predicate, RDFS_COMMENT)) {
                OntologyClass *klass;
                OntologyProperty *prop;
@@ -190,6 +184,22 @@ load_in_memory (Ontology    *ontology,
                        }
                }
 
+       } else if (!g_strcmp0 (turtle_predicate, TRACKER_SPECIFICATION)) {
+               OntologyClass *klass;
+               OntologyProperty *prop;
+
+               klass = g_hash_table_lookup (ontology->classes, turtle_subject);
+               if (klass) {
+                       klass->specification = g_strdup (turtle_object);
+               } else {
+                       prop = g_hash_table_lookup (ontology->properties, turtle_subject);
+                       if (prop) {
+                               prop->specification = g_strdup (turtle_object);
+                       } else {
+                               g_error ("Error in specification (%s doesn't exist)", turtle_subject);
+                       }
+               }
+
        } else if (!g_strcmp0 (turtle_predicate, RDFS_DOMAIN)) {
                /*
                 * (prop A) has domain (class B)
@@ -358,41 +368,46 @@ ttl_loader_new_ontology (void)
        return ontology;
 }
 
-void
+gboolean
 ttl_loader_load_ontology (Ontology    *ontology,
-                          GFile       *ttl_file)
+                          GFile       *ttl_file,
+                          GError     **error)
 {
        TrackerTurtleReader *reader;
        const gchar *subject, *predicate, *object;
-       GError *error = NULL;
+       const gchar *base_url, *prefix;
+       GHashTableIter iter;
+       GError *inner_error = NULL;
 
-       g_return_if_fail (G_IS_FILE (ttl_file));
+       g_return_val_if_fail (G_IS_FILE (ttl_file), 0);
 
-       reader = tracker_turtle_reader_new_for_file (ttl_file, &error);
+       reader = tracker_turtle_reader_new_for_file (ttl_file, &inner_error);
 
-       while (error == NULL &&
+       while (inner_error == NULL &&
               tracker_turtle_reader_next (reader,
                                           &subject, &predicate, &object,
-                                          NULL, &error)) {
+                                          NULL, &inner_error)) {
                load_in_memory (ontology, subject, predicate, object);
        }
 
-       g_clear_object (&reader);
+       g_hash_table_iter_init (&iter, tracker_turtle_reader_get_prefixes (reader));
+       while (g_hash_table_iter_next (&iter, (gpointer *) &prefix, (gpointer *) &base_url)) {
+               gchar *prefix_no_colon;
 
-       if (error) {
-               g_message ("Turtle parse error: %s", error->message);
-               g_error_free (error);
+               prefix_no_colon = g_strdup (prefix);
+               if (strrchr (prefix_no_colon, ':'))
+                       *strrchr (prefix_no_colon, ':') = '\0';
+
+               g_hash_table_insert (ontology->prefixes, g_strdup (base_url), prefix_no_colon);
        }
-}
 
-void
-ttl_loader_load_prefix_from_description (Ontology            *ontology,
-                                         OntologyDescription *description)
-{
-       if (!g_hash_table_lookup (ontology->prefixes, description->baseUrl)) {
-               g_hash_table_insert (ontology->prefixes,
-                                    g_strdup (description->baseUrl),
-                                    g_strdup (description->localPrefix));
+       g_clear_object (&reader);
+
+       if (inner_error) {
+               g_propagate_error (error, inner_error);
+               return FALSE;
+       } else {
+               return TRUE;
        }
 }
 
diff --git a/docs/tools/ttl_loader.h b/docs/tools/ttl_loader.h
index 1f4fc50c3..b70bd33b4 100644
--- a/docs/tools/ttl_loader.h
+++ b/docs/tools/ttl_loader.h
@@ -28,8 +28,9 @@ G_BEGIN_DECLS
 
 Ontology            * ttl_loader_new_ontology     (void);
 
-void                  ttl_loader_load_ontology    (Ontology    *ontology,
-                                                  GFile       *filename);
+gboolean              ttl_loader_load_ontology    (Ontology    *ontology,
+                                                   GFile       *filename,
+                                                   GError     **error);
 OntologyDescription * ttl_loader_load_description (GFile       *filename);
 
 void                  ttl_loader_load_prefix_from_description (Ontology            *ontology,
diff --git a/docs/tools/ttl_model.c b/docs/tools/ttl_model.c
index cf45d5227..46801e164 100644
--- a/docs/tools/ttl_model.c
+++ b/docs/tools/ttl_model.c
@@ -28,6 +28,7 @@ ttl_model_class_new (const gchar *classname)
        def = g_new0 (OntologyClass, 1);
 
        def->classname = g_strdup (classname);
+       def->specification = NULL;
        def->superclasses = NULL;
        def->subclasses = NULL;
        def->in_domain_of = NULL;
@@ -51,6 +52,7 @@ ttl_model_class_free (OntologyClass *def)
        g_list_free_full (def->in_range_of, (GDestroyNotify) g_free);
 
        g_free (def->description);
+       g_free (def->specification);
 
        g_list_free_full (def->instances, (GDestroyNotify) g_free);
 
@@ -65,6 +67,7 @@ ttl_model_property_new (const gchar *propname)
        prop = g_new0 (OntologyProperty, 1);
 
        prop->propertyname = g_strdup (propname);
+       prop->specification = NULL;
        prop->type = NULL;
        prop->domain = NULL;
        prop->range = NULL;
@@ -93,6 +96,7 @@ ttl_model_property_free (OntologyProperty *def)
        g_free (def->max_cardinality);
        g_free (def->description);
        g_free (def->weight);
+       g_free (def->specification);
        g_free (def);
 }
 
@@ -183,3 +187,20 @@ ttl_model_name_to_shortname (Ontology    *ontology,
 
        return g_strconcat (short_prefix, separator, suffix, NULL);
 }
+
+gchar *
+ttl_model_name_to_basename (Ontology    *ontology,
+                            const gchar *name)
+{
+       g_autofree gchar *prefix = NULL;
+       const gchar *suffix;
+
+       prefix = name_get_prefix (ontology, name);
+
+       if (!prefix)
+               return g_strdup (name);
+
+       suffix = &name[strlen (prefix)];
+
+       return g_strdup (suffix);
+}
diff --git a/docs/tools/ttl_model.h b/docs/tools/ttl_model.h
index 3a0be9871..a3758b0a2 100644
--- a/docs/tools/ttl_model.h
+++ b/docs/tools/ttl_model.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
 
 typedef struct {
        gchar *classname;
+       gchar *specification;
        GList *superclasses;
        GList *subclasses;
        GList *in_domain_of;
@@ -38,6 +39,7 @@ typedef struct {
 
 typedef struct {
        gchar *propertyname;
+       gchar *specification;
        GList *type;
        GList *domain;
        GList *range;
@@ -84,6 +86,8 @@ gchar *               ttl_model_name_to_shortname (Ontology    *ontology,
                                                    const gchar *name,
                                                    const gchar *separator);
 
+gchar *               ttl_model_name_to_basename (Ontology    *ontology,
+                                                  const gchar *name);
 G_END_DECLS
 
 #endif /* __TRACKER_TTL_MODEL_H__ */
diff --git a/docs/tools/ttl_xml.c b/docs/tools/ttl_xml.c
index 44d10379c..a5a0af308 100644
--- a/docs/tools/ttl_xml.c
+++ b/docs/tools/ttl_xml.c
@@ -20,6 +20,7 @@
 #include <glib/gprintf.h>
 
 #include "ttl_xml.h"
+#include "ttlresource2xml.h"
 
 typedef struct {
        Ontology *ontology;
@@ -89,69 +90,207 @@ print_deprecated_message (FILE *f)
 static void
 print_xml_header (FILE *f, OntologyDescription *desc)
 {
-        gchar *upper_name;
-
-        g_fprintf (f, "<?xml version='1.0' encoding='UTF-8'?>\n");
+       g_fprintf (f, "<?xml version='1.0' encoding='UTF-8'?>\n");
        g_fprintf (f, "<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.5//EN\"\n"
-                  "        \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"; [\n");
+                  "        \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"; [\n");
        g_fprintf (f, "<!ENTITY %% local.common.attrib \"xmlns:xi  CDATA  #FIXED 
'http://www.w3.org/2003/XInclude'\">\n");
        g_fprintf (f, "]>");
 
-        g_fprintf (f, "<chapter id='%s-ontology' xmlns:xi=\"http://www.w3.org/2003/XInclude\";>\n", 
desc->localPrefix);
+       g_fprintf (f, "<refentry id='%s' xmlns:xi=\"http://www.w3.org/2003/XInclude\";>\n", desc->localPrefix);
+       g_fprintf (f, "<refmeta>\n");
+       g_fprintf (f, "  <refentrytitle>%s</refentrytitle>\n", desc->title);
+       g_fprintf (f, "</refmeta>\n");
+       g_fprintf (f, "<refnamediv>\n");
+       g_fprintf (f, "<refname>%s</refname>", desc->title);
+       g_fprintf (f, "<refpurpose>%s</refpurpose>", desc->description);
+       g_fprintf (f, "</refnamediv>\n");
+}
 
-        upper_name = g_ascii_strup (desc->localPrefix, -1);
-        g_fprintf (f, "<title>%s: %s</title>\n", desc->title, desc->description ? desc->description : "");
-        g_free (upper_name);
+static void
+print_xml_footer (FILE *f, OntologyDescription *desc)
+{
+       g_fprintf (f, "<refsect1>\n");
+       g_fprintf (f, "<title>Credits and Copyright</title>\n");
+       print_people_list (f, "Authors:", desc->authors);
+       print_people_list (f, "Editors:", desc->editors);
+       print_people_list (f, "Contributors:", desc->contributors);
 
-        print_people_list (f, "Authors:", desc->authors);
-        print_people_list (f, "Editors:", desc->editors);
-        print_people_list (f, "Contributors:", desc->contributors);
+       print_link_as_varlistentry (f, "Upstream:", "Upstream version", desc->upstream);
+       print_link_as_varlistentry (f, "ChangeLog:", "Tracker changes", desc->gitlog);
 
-        print_link_as_varlistentry (f, "Upstream:", "Upstream version", desc->upstream);
-        print_link_as_varlistentry (f, "ChangeLog:", "Tracker changes", desc->gitlog);
+       if (desc->copyright) {
+               g_fprintf (f, "<varlistentry>\n");
+               g_fprintf (f, "  <term>Copyright:</term>\n");
+               g_fprintf (f, "  <listitem>\n");
+               g_fprintf (f, "<para>%s</para>\n", desc->copyright);
+               g_fprintf (f, "  </listitem>\n");
+               g_fprintf (f, "</varlistentry>\n");
+    }
 
-        if (desc->copyright) {
-               g_fprintf (f, "<varlistentry>\n");
-               g_fprintf (f, "  <term>Copyright:</term>\n");
-               g_fprintf (f, "  <listitem>\n");
-               g_fprintf (f, "<para>%s</para>\n", desc->copyright);
-               g_fprintf (f, "  </listitem>\n");
-               g_fprintf (f, "</varlistentry>\n");
-        }
+       g_fprintf (f, "</refsect1>\n");
+       g_fprintf (f, "</refentry>\n");
+}
+
+static gint compare_class (gconstpointer a,
+                           gconstpointer b)
+{
+       return strcmp (((OntologyClass *)a)->classname, ((OntologyClass *)b)->classname);
+}
+
+/* By default we list properties under their respective class.
+ *
+ * Ontologies can contain properties whose class is in a different
+ * ontology, and we treat these specially as 'extra properties'.
+ *
+ * This functions returns a hash table mapping class name to the
+ * extra properties provided for that class.
+ */
+static GHashTable *
+get_extra_properties (GList *classes,
+                      GList *properties)
+{
+       GList *l, *c;
+       GHashTable *extra_properties;
+       GHashTableIter iter;
+       gchar *classname;
+       GList *properties_for_class;
+
+       extra_properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+       for (l = properties; l; l = l->next) {
+               OntologyProperty *prop = l->data;
+               gboolean has_domain_in_this_ontology = FALSE;
+
+               for (c = classes; c; c = c->next) {
+                       OntologyClass *klass;
+
+                       klass = c->data;
+                       if (g_list_find_custom (prop->domain, klass->classname, (GCompareFunc)strcmp)) {
+                               has_domain_in_this_ontology = TRUE;
+                               break;
+                       }
+               }
+
+               if (!has_domain_in_this_ontology) {
+                       for (c = prop->domain; c; c = c->next) {
+                               const gchar *classname;
+                               GList *list;
+
+                               classname = c->data;
+                               list = g_hash_table_lookup (extra_properties, classname);
+                               list = g_list_append (list, prop->propertyname);
+                               g_hash_table_insert (extra_properties, g_strdup (classname), list);
+                       }
+               }
+       }
+
+       g_hash_table_iter_init (&iter, extra_properties);
+       while (g_hash_table_iter_next (&iter, (gpointer *)&classname, (gpointer *)&properties_for_class)) {
+               properties_for_class = g_list_sort (properties_for_class, (GCompareFunc) strcmp);
+               g_hash_table_iter_replace (&iter, properties_for_class);
+       }
+
+       return extra_properties;
+}
+
+static void
+print_synopsis (FILE                 *f,
+                OntologyDescription *desc)
+{
+       g_fprintf (f, "<refsynopsisdiv>\n");
+       g_fprintf (f, "<synopsis>\n");
+       g_fprintf (f, "@prefix %s: &lt;%s&gt;\n", desc->localPrefix, desc->baseUrl);
+       g_fprintf (f, "</synopsis>\n");
+       g_fprintf (f, "</refsynopsisdiv>\n");
 }
 
 static void
-print_xml_footer (FILE *f)
+print_toc_classes (FILE       *f,
+                   Ontology   *ontology,
+                   const char *id,
+                   GList      *classes)
 {
-       g_fprintf (f,"</chapter>\n");
+       GList *l;
+
+       if (!classes)
+               return;
+
+       g_fprintf (f, "<refsect1 id=\"%s.classes\">", id);
+       g_fprintf (f, "<title>Classes</title>");
+
+       for (l = classes; l; l = l->next) {
+               OntologyClass *klass;
+               g_autofree char *basename = NULL, *id = NULL;
+
+               klass = l->data;
+               basename = ttl_model_name_to_basename (ontology, klass->classname);
+               id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
+
+               if (l != classes) {
+                       g_fprintf (f, ", ");
+               }
+               g_fprintf (f, "<link linkend=\"%s\">%s</link>", id, basename);
+       }
+
+       g_fprintf (f, "</refsect1>");
 }
 
 static void
-print_ontology_class (Ontology      *ontology,
-                     OntologyClass *def,
-                     FILE          *f)
+print_toc_extra_properties (FILE       *f,
+                            Ontology   *ontology,
+                            const char *id,
+                            GHashTable *extra_properties)
 {
-       gchar *name, *id;
+       GList *props_for_class, *c, *l;
+       g_autoptr(GList) classes = NULL;
+       gboolean print_comma = FALSE;
+
+       if (g_hash_table_size (extra_properties) == 0)
+               return;
+
+       g_fprintf (f, "<refsect1 id=\"%s.extra_properties\">", id);
+       g_fprintf (f, "<title>Additional Properties</title>");
+
+       classes = g_hash_table_get_keys (extra_properties);
+       classes = g_list_sort (classes, (GCompareFunc)strcmp);
+       for (c = classes; c; c = c->next) {
+               gchar *classname;
+
+               classname = c->data;
+               props_for_class = g_hash_table_lookup (extra_properties, classname);
+               for (l = props_for_class; l; l = l->next) {
+                       OntologyProperty *prop;
+                       g_autofree char *basename = NULL, *prop_id = NULL;
+
+                       prop = g_hash_table_lookup (ontology->properties, l->data);
 
-       g_return_if_fail (f != NULL);
+                       basename = ttl_model_name_to_basename (ontology, prop->propertyname);
+                       prop_id = ttl_model_name_to_shortname (ontology, prop->propertyname, "-");
 
-       name = ttl_model_name_to_shortname (ontology, def->classname, NULL);
-       id = ttl_model_name_to_shortname (ontology, def->classname, "-");
-       g_fprintf (f, "<xi:include href='%s.xml'/>\n", id);
-       g_free (id);
+                       if (print_comma) {
+                               g_fprintf (f, ", ");
+                       } else {
+                               print_comma = TRUE;
+                       }
 
-        g_free (name);
+                       g_fprintf (f, "<link linkend=\"%s\">%s</link>", prop_id, basename);
+               }
+       }
+
+       g_fprintf (f, "</refsect1>");
 }
 
+/* Generate docbook XML document for one ontology. */
 void
 ttl_xml_print (OntologyDescription *description,
-                Ontology            *ontology,
-                GFile               *file,
-                const gchar         *description_dir)
+               Ontology            *ontology,
+               GFile               *file,
+               const gchar         *description_dir)
 {
-       GHashTableIter iter;
        gchar *upper_name, *path, *introduction, *basename;
-       OntologyClass *def;
+       g_autoptr(GList) classes = NULL, properties = NULL, extra_classes = NULL;
+       g_autoptr(GHashTable) extra_properties = NULL;
+       GList *l;
        FILE *f;
 
        path = g_file_get_path (file);
@@ -159,9 +298,18 @@ ttl_xml_print (OntologyDescription *description,
        g_assert (f != NULL);
        g_free (path);
 
-        upper_name = g_ascii_strup (description->localPrefix, -1);
+       upper_name = g_ascii_strup (description->localPrefix, -1);
+       classes = g_list_sort (g_hash_table_get_values (ontology->classes), compare_class);
+       properties = g_hash_table_get_values (ontology->properties);
+
+       extra_properties = get_extra_properties (classes, properties);
+
        print_xml_header (f, description);
 
+       print_synopsis (f, description);
+       print_toc_classes (f, ontology, description->localPrefix, classes);
+       print_toc_extra_properties (f, ontology, description->localPrefix, extra_properties);
+
        basename = g_strdup_printf ("%s-introduction.xml", description->localPrefix);
        introduction = g_build_filename (description_dir, basename, NULL);
        g_free (basename);
@@ -171,16 +319,39 @@ ttl_xml_print (OntologyDescription *description,
                           introduction);
        }
 
-        g_fprintf (f, "<section id='%s-classes'>\n", description->localPrefix);
-       g_fprintf (f, "<title>%s Ontology Classes</title>\n", upper_name);
-       g_hash_table_iter_init (&iter, ontology->classes);
+       if (classes != NULL) {
+       g_fprintf (f, "<refsect1 id='%s-classes'>\n", description->localPrefix);
+               g_fprintf (f, "<title>Class Details</title>\n");
+
+               for (l = classes; l; l = l->next) {
+                       print_ontology_class (ontology, l->data, f);
+               }
+
+               g_fprintf (f, "</refsect1>\n");
+       }
+
+       if (g_hash_table_size (extra_properties) > 0) {
+               g_fprintf (f, "<refsect1 id='%s-extra-properties'>\n", description->localPrefix);
+               g_fprintf (f, "<title>Property Details</title>\n");
+
+               extra_classes = g_hash_table_get_keys (extra_properties);
+               extra_classes = g_list_sort (extra_classes, (GCompareFunc)strcmp);
+               for (l = extra_classes; l; l = l->next) {
+                       gchar *classname;
+                       GList *properties_for_class;
+
+                       classname = l->data;
+
+                       properties_for_class = g_hash_table_lookup (extra_properties, classname);
+                       if (properties_for_class) {
+                               print_ontology_extra_properties (ontology, description->localPrefix, 
classname, properties_for_class, f);
+                       }
+               }
 
-       while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &def)) {
-               print_ontology_class (ontology, def, f);
+               g_fprintf (f, "</refsect1>\n");
        }
 
-        g_fprintf (f, "</section>\n");
-       print_xml_footer (f);
+       print_xml_footer (f, description);
 
        g_free (upper_name);
        g_free (introduction);
diff --git a/docs/tools/ttlresource2xml.c b/docs/tools/ttlresource2xml.c
index e5139583e..9fffcc1f2 100644
--- a/docs/tools/ttlresource2xml.c
+++ b/docs/tools/ttlresource2xml.c
@@ -22,6 +22,7 @@
 #include <glib-object.h>
 #include <glib/gprintf.h>
 #include <gio/gio.h>
+#include <stdlib.h>
 #include "ttl_loader.h"
 #include "ttl_model.h"
 #include "ttl_xml.h"
@@ -74,48 +75,6 @@ class_get_hierarchy (Ontology      *ontology,
        return hierarchy;
 }
 
-static void
-print_xml_header (FILE          *f,
-                   OntologyClass *klass,
-                   Ontology      *ontology)
-{
-       gchar *id, *shortname;
-
-       id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
-       shortname = ttl_model_name_to_shortname (ontology, klass->classname, NULL);
-
-        g_fprintf (f, "<?xml version='1.0' encoding='UTF-8'?>\n");
-        g_fprintf (f, "<refentry id='%s'>\n", id);
-
-        g_fprintf (f, "<refmeta><refentrytitle>%s</refentrytitle></refmeta>", shortname);
-        g_fprintf (f, "<refnamediv><refname>%s</refname></refnamediv>", shortname);
-
-       g_fprintf (f, "<refsect1 id='%s.description'>", id);
-
-       if (klass->description) {
-               g_fprintf (f, "<title>Description</title>\n");
-               g_fprintf (f, "<para>%s</para>\n", klass->description);
-       }
-
-       if (klass->deprecated)
-               g_fprintf (f, "<note><para>This class is deprecated.</para></note>\n");
-
-       if (klass->notify)
-               g_fprintf (f, "<note><para>This class emits notifications about changes, and can "
-                          "be tracked through the <literal>GraphUpdated</literal> DBus 
signal.</para></note>\n");
-
-       g_fprintf (f, "</refsect1>");
-
-       g_free (shortname);
-       g_free (id);
-}
-
-static void
-print_xml_footer (FILE *f)
-{
-       g_fprintf (f, "</refentry>\n");
-}
-
 static void
 print_predefined_instances (FILE          *f,
                             OntologyClass *klass,
@@ -130,7 +89,7 @@ print_predefined_instances (FILE          *f,
        shortname = ttl_model_name_to_shortname (ontology, klass->classname, NULL);
        id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
 
-       g_fprintf (f, "<refsect1 id='%s.predefined-instances'>", id);
+       g_fprintf (f, "<refsect3 id='%s.predefined-instances'>", id);
        g_fprintf (f, "<title>Predefined instances</title><para>");
        g_fprintf (f, "%s has the following predefined instances: ", shortname);
         g_fprintf (f, "<itemizedlist>\n");
@@ -147,55 +106,7 @@ print_predefined_instances (FILE          *f,
                g_free (shortname);
        }
 
-       g_fprintf (f, "</itemizedlist></para></refsect1>\n");
-}
-
-static void
-print_fts_properties (FILE          *f,
-                      OntologyClass *klass,
-                      Ontology      *ontology)
-{
-       gchar *shortname, *id;
-       GList *l, *fts_props = NULL;
-
-       for (l = klass->in_domain_of; l; l = l->next) {
-               OntologyProperty *prop;
-
-               prop = g_hash_table_lookup (ontology->properties, l->data);
-
-               if (prop->fulltextIndexed)
-                       fts_props = g_list_prepend (fts_props, prop);
-       }
-
-       if (!fts_props)
-               return;
-
-       shortname = ttl_model_name_to_shortname (ontology, klass->classname, NULL);
-       id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
-
-       g_fprintf (f, "<refsect1 id='%s.fts-properties'>", id);
-       g_fprintf (f, "<title>Full-text-indexed properties</title><para>");
-       g_fprintf (f, "%s has the following full-text-indexed properties: ", shortname);
-        g_fprintf (f, "<itemizedlist>\n");
-
-       for (l = fts_props; l; l = l->next) {
-               gchar *prop_shortname, *prop_id;
-               OntologyProperty *prop = l->data;
-
-               prop_shortname = ttl_model_name_to_shortname (ontology, prop->propertyname, NULL);
-               prop_id = ttl_model_name_to_shortname (ontology, prop->propertyname, "-");
-
-               g_fprintf (f, "<listitem><para>");
-               g_fprintf (f, "<link linkend=\"%s.%s\">%s</link>", id, prop_id, prop_shortname);
-               g_fprintf (f, "</para></listitem>\n");
-               g_free (prop_shortname);
-               g_free (prop_id);
-       }
-
-       g_fprintf (f, "</itemizedlist></para></refsect1>\n");
-       g_free (shortname);
-       g_free (id);
-       g_list_free (fts_props);
+       g_fprintf (f, "</itemizedlist></para></refsect3>\n");
 }
 
 typedef struct {
@@ -512,6 +423,9 @@ class_get_parent_hierarchy_strings (OntologyClass *klass,
 
        context = hierarchy_context_new (klass, ontology);
 
+       /* Proceed from parent to child classes, populating the 
+        * context->strings array.
+        */
        for (c = context->hierarchy; c; c = c->next) {
                OntologyClass *cl = g_hash_table_lookup (ontology->classes, c->data);
                hierarchy_context_resolve_class (context, cl, ontology);
@@ -539,7 +453,7 @@ print_class_hierarchy (FILE          *f,
 
        id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
 
-       g_fprintf (f, "<refsect1 id='%s.hierarchy'>", id);
+       g_fprintf (f, "<refsect3 id='%s.hierarchy'>", id);
        g_fprintf (f, "<title>Class hierarchy</title>");
        g_fprintf (f, "<screen>");
 
@@ -550,166 +464,222 @@ print_class_hierarchy (FILE          *f,
                g_fprintf (f, "    %s\n", str->str->str);
        }
 
-       g_fprintf (f, "</screen></refsect1>\n");
+       g_fprintf (f, "</screen></refsect3>\n");
        g_ptr_array_unref (strings);
 }
 
 static void
-print_properties (FILE          *f,
-                  OntologyClass *klass,
-                  Ontology      *ontology)
+print_flag (FILE *f,
+            const gchar *flag_property_link,
+            const gchar *icon_name,
+            const gchar *flag_description)
 {
-       gchar *id, *prop_id, *shortname, *type_name, *type_class_id;
-       GList *l;
+       /* This must not contain any linebreaks, or gtkdoc-fixxrefs will not
+        * resolve the link. See https://gitlab.gnome.org/GNOME/gtk-doc/-/issues/122
+        */
+       g_fprintf (f, "<link linkend=\"%s\">", flag_property_link);
+       g_fprintf (f, "<inlinemediaobject>");
+       g_fprintf (f, "<imageobject><imagedata fileref=\"%s\" /></imageobject>", icon_name);
+       g_fprintf (f, "<alt>%s</alt>", flag_description);
+       g_fprintf (f, "</inlinemediaobject>");
+       g_fprintf (f, "</link>");
+};
 
-       if (!klass->in_domain_of)
+static void
+print_property_table (FILE          *f,
+                      Ontology      *ontology,
+                      const char    *id,
+                      GList         *properties)
+{
+       GList *l, *m;
+       g_autoptr(GList) properties_sorted = NULL;
+
+       if (!properties)
                return;
 
-       id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
-       g_fprintf (f, "<refsect1 id='%s.properties'>", id);
+       properties_sorted = g_list_sort (g_list_copy (properties), (GCompareFunc) strcmp);
+
+       /* We (ab)use the "struct_members" role to ensure devhelp2 <keyword> entries are
+        * generated by gtkdoc-mkhtml2. This is needed for xrefs to work between the
+        * libtracker-sparql and nepomuk ontology docs.
+        */
+       g_fprintf (f, "<refsect3 role=\"struct_members\" id=\"%s.properties\">", id);
        g_fprintf (f, "<title>Properties</title>");
 
-       for (l = klass->in_domain_of; l; l = l->next) {
+       g_fprintf (f, "<informaltable frame=\"none\"><tgroup cols=\"4\">");
+       g_fprintf (f, 
"<thead><row><entry>Name</entry><entry>Type</entry><entry>Notes</entry><entry>Description</entry></row></thead>");
+
+       g_fprintf (f, "<tbody>");
+       for (l = properties_sorted; l; l = l->next) {
                OntologyProperty *prop;
+               g_autofree gchar *shortname = NULL, *basename = NULL, *type_name = NULL, *type_class_id = 
NULL, *prop_id = NULL;
 
                prop = g_hash_table_lookup (ontology->properties, l->data);
 
                prop_id = ttl_model_name_to_shortname (ontology, prop->propertyname, "-");
                shortname = ttl_model_name_to_shortname (ontology, prop->propertyname, NULL);
-               type_name = ttl_model_name_to_shortname (ontology, prop->range->data, NULL);
+               basename = ttl_model_name_to_basename (ontology, prop->propertyname);
+               type_name = ttl_model_name_to_basename (ontology, prop->range->data);
                type_class_id = ttl_model_name_to_shortname (ontology, prop->range->data, "-");
 
-               g_fprintf (f, "<refsect2 id='%s.%s' role='property'>", id, prop_id);
-               g_fprintf (f, "<indexterm zone='%s.%s'><primary sortas='%s'>%s</primary></indexterm>",
-                          id, prop_id, shortname, shortname);
-               g_fprintf (f, "<title>The <literal>“%s”</literal> property</title>", shortname);
-               g_fprintf (f, "<programlisting>“%s”"
-                          "          <link linkend=\"%s\">%s</link>"
-                          "</programlisting>",
-                          shortname, type_class_id, type_name);
+               g_fprintf (f, "<row role=\"member\">");
 
-               if (prop->description) {
-                       g_fprintf (f, "<para>%s</para>", prop->description);
+               /* Property name column */
+               g_fprintf (f, "<entry role=\"struct_member_name\">");
+               /* This id is globally unique and can be used for internal links.
+                * We abuse <structfield> so that gtkdoc-mkhtml2 creates a usable link. */
+               g_fprintf (f, "<para><structfield id=\"%s\">%s</structfield></para>", prop_id, basename);
+               /* This anchor is unique within the refentry and can be used for external links */
+               g_fprintf (f, "<anchor id='%s' />", basename);
+               g_fprintf (f, "<indexterm zone='%s'><primary sortas='%s'>%s</primary></indexterm>",
+                          prop_id, shortname, shortname);
+               g_fprintf (f, "</entry>");
+
+               /* Type column */
+               g_fprintf (f, "<entry>");
+               g_fprintf (f, "<link linkend=\"%s\">%s</link>", type_class_id, type_name);
+               g_fprintf (f, "</entry>");
+
+               /* Flags column */
+               g_fprintf (f, "<entry>");
+
+               if (prop->deprecated) {
+                       print_flag (f, "tracker-deprecated", "icon-deprecated.svg",
+                                   "This property is deprecated.");
                }
 
-               if (prop->max_cardinality) {
-                       g_fprintf (f, "<para>Number of possible elements per resource (Cardinality): 
%s</para>",
-                                  prop->max_cardinality);
+               if (prop->superproperties) {
+                       for (m = prop->superproperties; m; m = m->next) {
+                               g_autofree gchar *shortname = NULL, *superprop_id = NULL;
+                               g_autofree gchar *message = NULL;
+
+                               shortname = ttl_model_name_to_shortname (ontology, m->data, NULL);
+                               superprop_id = ttl_model_name_to_shortname (ontology, m->data, "-");
+
+                               message = g_strdup_printf ("This property extends %s", shortname);
+
+                               print_flag (f, superprop_id, "icon-superproperty.svg", message);
+                       }
+               }
+               g_fprintf (f, "</entry>");
+
+               if (prop->max_cardinality != NULL && atoi (prop->max_cardinality) == 1) {
+                       /* Single valued properties are most common, so we don't display this. */
                } else {
-                       g_fprintf (f, "<para>Number of possible elements per resource (Cardinality): 
Unlimited</para>");
+                       g_autofree gchar *message = NULL;
+
+                       if (prop->max_cardinality != NULL && atoi (prop->max_cardinality) > 0) {
+                               message = g_strdup_printf ("This property can have a maximum of %i values", 
*prop->max_cardinality);
+                       } else {
+                               message = g_strdup_printf ("This property can have multiple values.");
+                       }
+                       print_flag (f, "nrl-maxCardinality", "icon-multivalue.svg", message);
                }
 
                if (prop->fulltextIndexed) {
-                       g_fprintf (f, "<note><para>This property is full-text-indexed, and can be looked up 
through <literal>fts:match</literal>.</para></note>\n");
+                       print_flag (f, "tracker-fulltextIndexed", "icon-fulltextindexed.svg",
+                                   "This property is full-text-indexed, and can be looked up through 
<literal>fts:match</literal>");
                }
 
-               if (prop->deprecated) {
-                       g_fprintf (f, "<note><para>This property is deprecated.</para></note>\n");
+               /* Description column */
+               g_fprintf (f, "<entry>");
+               if (prop->description) {
+                       g_fprintf (f, "<para>%s</para>", prop->description);
                }
+               g_fprintf (f, "</entry>");
+               g_fprintf (f, "</row>");
+       }
 
-               if (prop->superproperties) {
-                       GList *l;
-
-                       g_fprintf (f, "<note><para>This property supersedes the following properties from 
this or parent classes:</para>\n");
-                       g_fprintf (f, "<itemizedlist>\n");
-
-                       for (l = prop->superproperties; l; l = l->next) {
-                               gchar *class_shortname, *shortname, *class_id, *superprop_id;
-                               OntologyProperty *superprop;
-                               OntologyClass *cl;
+       g_fprintf (f, "</tbody></tgroup>");
+       g_fprintf (f, "</informaltable>");
 
-                               superprop = g_hash_table_lookup (ontology->properties, l->data);
+       g_fprintf (f, "</refsect3>");
+}
 
-                               if (!superprop) {
-                                       superprop = ttl_model_property_new (l->data);
-                                       g_hash_table_insert (ontology->properties, g_strdup 
(superprop->propertyname), superprop);
-                               }
+void
+print_ontology_class (Ontology      *ontology,
+                      OntologyClass *klass,
+                      FILE          *f)
+{
+       g_autofree gchar *name, *id;
 
-                               if (!superprop->domain)
-                                       continue;
+       g_return_if_fail (f != NULL);
 
-                               cl = g_hash_table_lookup (ontology->classes, superprop->domain->data);
+       name = ttl_model_name_to_basename (ontology, klass->classname);
+       id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
 
-                               shortname = ttl_model_name_to_shortname (ontology, superprop->propertyname, 
NULL);
-                               class_shortname = ttl_model_name_to_shortname (ontology, cl->classname, NULL);
-                               superprop_id = ttl_model_name_to_shortname (ontology, 
superprop->propertyname, "-");
-                               class_id = ttl_model_name_to_shortname (ontology, cl->classname, "-");
+       /* Anchor for external links. */
+       g_fprintf (f, "<anchor id='%s' />\n", name);
 
-                               g_fprintf (f, "<listitem><para>");
-                               g_fprintf (f, "<link linkend=\"%s.%s\"><literal>“%s”</literal> from the 
<literal>%s</literal> class</link>",
-                                          class_id, superprop_id,
-                                          shortname, class_shortname);
-                               g_fprintf (f, "</para></listitem>\n");
+       g_fprintf (f, "<refsect2 role='rdf-class' id='%s'>\n", id);
+       g_fprintf (f, "<title>%s</title>\n", name);
 
-                               g_free (class_id);
-                               g_free (superprop_id);
-                               g_free (class_shortname);
-                               g_free (shortname);
-                       }
+       if (klass->description || klass->description || klass->notify) {
+               g_fprintf (f, "<refsect3 id='%s.description'>\n", id);
+               g_fprintf (f, "  <title>Description</title>\n");
 
-                       g_fprintf (f, "</itemizedlist></note>\n");
+               if (klass->description) {
+                       g_fprintf (f, "  %s", klass->description);
                }
 
-               g_fprintf (f, "</refsect2>\n");
+               if (klass->deprecated) {
+                       g_fprintf (f, "<para>");
+                       print_flag (f, "tracker-deprecated", "icon-deprecated.svg", "Deprecated icon");
+                       g_fprintf (f, "This class is deprecated.");
+                       g_fprintf (f, "</para>");
+               }
 
-               g_free (type_class_id);
-               g_free (type_name);
-               g_free (shortname);
-               g_free (prop_id);
+               if (klass->notify) {
+                       g_fprintf (f, "<para>");
+                       print_flag (f, "tracker-notify", "icon-notify.svg", "Notify icon");
+                       g_fprintf (f, "This class emits notifications about changes, and can "
+                                    "be monitored using <link 
linkend=\"TrackerNotifier\">TrackerNotifier</link>.");
+                       g_fprintf (f, "</para>");
+               }
+               g_fprintf (f, "</refsect3>\n");
        }
 
-       g_fprintf (f, "</refsect1>");
-       g_free (id);
-}
+       if (klass->specification) {
+               g_fprintf (f, "<refsect3 id='%s.specification'>\n", id);
+               g_fprintf (f, "  <title>Specification</title>\n");
+               g_fprintf (f, "  <ulink url=\"%s\" />", klass->specification);
+               g_fprintf (f, "</refsect3>\n");
+       }
 
-static void
-generate_class_docs (OntologyClass *klass,
-                     Ontology      *ontology,
-                     FILE          *f)
-{
-       print_xml_header (f, klass, ontology);
        print_class_hierarchy (f, klass, ontology);
        print_predefined_instances (f, klass, ontology);
-       print_fts_properties (f, klass, ontology);
-       print_properties (f, klass, ontology);
-       print_xml_footer (f);
+
+       print_property_table (f, ontology, id, klass->in_domain_of);
+
+       g_fprintf (f, "</refsect2>\n");
 }
 
 void
-generate_ontology_class_docs (Ontology *ontology,
-                              GFile    *output_dir)
+print_ontology_extra_properties (Ontology      *ontology,
+                                 const char    *ontology_prefix,
+                                 const char    *classname,
+                                 GList         *properties_for_class,
+                                 FILE          *f)
 {
-       OntologyClass *klass;
-       GList *classes, *l;
-       FILE *f;
+       g_autofree gchar *short_classname = NULL;
+       g_autofree gchar *section_id = NULL, *class_id = NULL;
 
-       classes = g_hash_table_get_values (ontology->classes);
+       g_return_if_fail (f != NULL);
 
-       for (l = classes; l; l = l->next) {
-               gchar *shortname, *class_filename, *output_file;
-               GFile *child;
+       short_classname = ttl_model_name_to_shortname (ontology, classname, ":");
 
-               klass = l->data;
-               shortname = ttl_model_name_to_shortname (ontology, klass->classname, "-");
-               class_filename = g_strdup_printf ("%s.xml", shortname);
-               child = g_file_get_child (output_dir, class_filename);
+       class_id = ttl_model_name_to_shortname (ontology, classname, "-");
+       section_id = g_strconcat (ontology_prefix, ".", class_id, NULL);
 
-               output_file = g_file_get_path (child);
-               g_object_unref (child);
+       g_fprintf (f, "<refsect2 role='rdf-property-list' id='%s'>\n", section_id);
+       g_fprintf (f, "<title>Additional properties for %s</title>\n", short_classname);
 
-               f = fopen (output_file, "w");
-
-               if (f == NULL) {
-                       g_error ("Could not open %s for writing.\n", output_file);
-               }
-
-               g_free (class_filename);
-               g_free (output_file);
-               g_free (shortname);
-
-               generate_class_docs (klass, ontology, f);
-               fclose (f);
-       }
+       g_fprintf (f, "<refsect3>\n");
+       g_fprintf (f, "  <title>Description</title>\n");
+       g_fprintf (f, "  <para>Properties this ontology defines which can describe %s resources.</para>",
+                  short_classname);
+       g_fprintf (f, "</refsect3>\n");
 
-       g_list_free (classes);
+       print_property_table (f, ontology, section_id, properties_for_class);
+       g_fprintf (f, "</refsect2>\n");
 }
diff --git a/docs/tools/ttlresource2xml.h b/docs/tools/ttlresource2xml.h
index 546ca8b9b..748e5bff0 100644
--- a/docs/tools/ttlresource2xml.h
+++ b/docs/tools/ttlresource2xml.h
@@ -27,8 +27,14 @@
 
 G_BEGIN_DECLS
 
-void generate_ontology_class_docs (Ontology *ontology,
-                                   GFile    *output_dir);
+void print_ontology_class (Ontology      *ontology,
+                           OntologyClass *klass,
+                           FILE          *f);
+void print_ontology_extra_properties (Ontology      *ontology,
+                                      const char    *ontology_prefix,
+                                      const char    *classname,
+                                      GList         *properties_for_class,
+                                      FILE          *f);
 
 G_END_DECLS
 
diff --git a/src/libtracker-data/tracker-turtle-reader.c b/src/libtracker-data/tracker-turtle-reader.c
index 28725725f..545d95475 100644
--- a/src/libtracker-data/tracker-turtle-reader.c
+++ b/src/libtracker-data/tracker-turtle-reader.c
@@ -678,3 +678,11 @@ tracker_turtle_reader_next (TrackerTurtleReader  *reader,
 
        return TRUE;
 }
+
+GHashTable *
+tracker_turtle_reader_get_prefixes (TrackerTurtleReader *reader)
+{
+       g_return_val_if_fail (TRACKER_IS_TURTLE_READER (reader), FALSE);
+
+       return reader->prefixes;
+}
diff --git a/src/libtracker-data/tracker-turtle-reader.h b/src/libtracker-data/tracker-turtle-reader.h
index d7c8c841b..892d2c46a 100644
--- a/src/libtracker-data/tracker-turtle-reader.h
+++ b/src/libtracker-data/tracker-turtle-reader.h
@@ -41,4 +41,6 @@ gboolean tracker_turtle_reader_next (TrackerTurtleReader  *reader,
                                      gboolean             *object_is_uri,
                                      GError              **error);
 
+GHashTable *tracker_turtle_reader_get_prefixes (TrackerTurtleReader *reader);
+
 #endif /* __TRACKER_TURTLE_READER_H__ */
diff --git a/src/ontologies/10-xsd.ontology b/src/ontologies/10-xsd.ontology
index 879abda15..ccc912861 100644
--- a/src/ontologies/10-xsd.ontology
+++ b/src/ontologies/10-xsd.ontology
@@ -7,15 +7,25 @@ xsd: a tracker:Namespace, tracker:Ontology ;
        tracker:lastModified "2010-02-16T11:00:00Z" .
 
 xsd:string a rdfs:Class ;
-    rdfs:comment "The type of string properties." .
+       rdfs:comment "The type of string properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#string> .
+
 xsd:boolean a rdfs:Class ;
-    rdfs:comment "The type of true / false properties." .
+       rdfs:comment "The type of true / false properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#boolean> .
+
 xsd:integer a rdfs:Class ;
-    rdfs:comment "The type of integer properties." .
+       rdfs:comment "The type of integer properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#integer> .
+
 xsd:double a rdfs:Class ;
-    rdfs:comment "The type of floating point properties." .
+       rdfs:comment "The type of floating point properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#double> .
+
 xsd:date a rdfs:Class ;
-    rdfs:comment "The type of date properties." .
-xsd:dateTime a rdfs:Class ;
-    rdfs:comment "The type of date-time properties." .
+       rdfs:comment "The type of date properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#date> .
 
+xsd:dateTime a rdfs:Class ;
+       rdfs:comment "The type of date-time properties." ;
+       tracker:specification <https://www.w3.org/TR/xmlschema-2/#dateTime> .
diff --git a/src/ontologies/11-rdf.ontology b/src/ontologies/11-rdf.ontology
index e0815acbc..3572bd8f9 100644
--- a/src/ontologies/11-rdf.ontology
+++ b/src/ontologies/11-rdf.ontology
@@ -13,71 +13,84 @@ rdfs: a tracker:Namespace ;
 
 rdfs:Resource a rdfs:Class ;
        rdfs:label "All Resources" ;
-       rdfs:comment "All resources" .
+       rdfs:comment "All resources" ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_resource> .
 
 rdfs:Class a rdfs:Class ;
        rdfs:label "Class" ;
        rdfs:comment "The class of classes" ;
-       rdfs:subClassOf rdfs:Resource .
+       rdfs:subClassOf rdfs:Resource ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_class> .
 
 rdf:Property a rdfs:Class ;
        rdfs:label "Property" ;
        rdfs:comment "The class of RDF properties" ;
-       rdfs:subClassOf rdfs:Resource .
+       rdfs:subClassOf rdfs:Resource ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_property> .
 
 rdfs:Literal a rdfs:Class ;
        rdfs:label "Literal" ;
        rdfs:comment "The class of literal values, eg. textual strings and integers" ;
-       rdfs:subClassOf rdfs:Resource .
+       rdfs:subClassOf rdfs:Resource ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_literal> .
 
 rdfs:Datatype a rdfs:Class ;
        rdfs:label "Datatype" ;
        rdfs:comment "The class of RDF datatypes." ;
-       rdfs:subClassOf rdfs:Class .
+       rdfs:subClassOf rdfs:Class ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_datatype> .
 
 rdf:langString a rdfs:Class, rdfs:Datatype ;
        rdfs:subClassOf rdfs:Literal ;
        rdfs:label "langString" ;
-       rdfs:comment "The datatype of language-tagged string values" .
+       rdfs:comment "The datatype of language-tagged string values" ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_langstring> .
 
 rdf:type a rdf:Property ;
        rdfs:domain rdfs:Resource ;
        rdfs:comment "The subject is an instance of a class" ;
-       rdfs:range rdfs:Class .
+       rdfs:range rdfs:Class ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_type> .
 
 rdfs:subClassOf a rdf:Property ;
        rdfs:comment "The subject is a subclass of a class" ;
        rdfs:domain rdfs:Class ;
-       rdfs:range rdfs:Class .
+       rdfs:range rdfs:Class ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_subclassof> .
 
 rdfs:subPropertyOf a rdf:Property ;
        rdfs:comment "The subject is a subproperty of a property" ;
        rdfs:domain rdf:Property ;
-       rdfs:range rdf:Property .
+       rdfs:range rdf:Property ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_subpropertyof> .
 
 rdfs:comment a rdf:Property ;
        rdfs:comment "A description of the subject resource" ;
        nrl:maxCardinality 1 ;
        rdfs:domain rdfs:Resource ;
-       rdfs:range xsd:string .
+       rdfs:range xsd:string ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_comment> .
 
 rdfs:label a rdf:Property ;
        rdfs:comment "A human-readable name for the subject" ;
        nrl:maxCardinality 1 ;
        rdfs:domain rdfs:Resource ;
-       rdfs:range xsd:string .
+       rdfs:range xsd:string ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_label> .
 
 rdfs:domain a rdf:Property ;
        rdfs:comment "A domain of the subject property" ;
        nrl:maxCardinality 1 ;
        rdfs:domain rdf:Property ;
-       rdfs:range rdfs:Resource .
+       rdfs:range rdfs:Resource ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_domain> .
 
 rdfs:range a rdf:Property ;
        rdfs:comment "A range of the subject property" ;
        nrl:maxCardinality 1 ;
        rdfs:domain rdf:Property ;
-       rdfs:range rdfs:Class .
+       rdfs:range rdfs:Class ;
+       tracker:specification <https://www.w3.org/TR/rdf-schema/#ch_range> .
 
 rdf:List a rdfs:Class ;
        rdfs:label "List" ;
@@ -184,3 +197,9 @@ tracker:deprecated a rdf:Property;
        rdfs:range xsd:boolean;
        rdfs:label "deprecated";
        rdfs:comment "If this property is assigned, the subject class, property, or resource, is deprecated 
and should not be used in production systems any longer. It may be removed without further notice." .
+
+tracker:specification a rdf:Property ;
+       nrl:maxCardinality 1 ;
+       rdfs:domain rdfs:Class , rdfs:Property ;
+       rdfs:range xsd:string ;
+       rdfs:comment "Link to upstream specification for an ontology class or property." .


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]