View Source

We want to show related annotations and forum posts in the first tab of the object (Object Details). Related annotations/posts for an object are the ones that mention it or its fields.

!related_objects.png!

Annotation's content is stored as text and we need to parse it and find out if any links to objects are present. We will do that when saving annotation/post.

If any linked objects are present in text, we need to refresh a list of related objects for the annotation/post in OWLIM. That is, each time annotation/post is edited we need to parse and recreate the list per annotation/post.

Annotations are identified by their URIs. Forum posts have numeric IDs. Forum posts are not currently stored in OWLIM. We need to generate URIs for them, for example: [http://researchspace.com/jforum/123] where '123' isthe post's ID.

h3. Storing related objects

1. When annotation or forum post are saved, we need to parse the text. We search for links like:



{noformat}
<a class="rslink linkMO" href="http://collection.britishmuseum.org/id/object/RFI41407">RFI41407 Chromolithograph pictorial label used for...</a>
{noformat}
or


{noformat}
<a class="rslink linkStatement" href="http://www.researchspace.org/st/2">amulet YCA70788 Glass two-finger amulet: this moulded funerary...: dimension</a>
{noformat}The first (linkMO) is a link to Museum Object while the second (linkStatement) is a link to annotation point.

We collect the URIs of the MO/AP. If is Annotation Point, the we load it and get URI if the object it belongs to. (See APLink class and APLink.annotationPoint.main)

After annotation is saved (so that we have the annotation's URI for new annotations), we recreate the list for related objects for this annotation. That is, we delete all related objects and create a new list that contains the latest ones.

Same goes for the forum posts.

Related objects are stored using a method in the&nbsp;DMS2RDF class.

h3. Retrieving related objects

There will be 2 methods in&nbsp;DMS2RDF:

URI\[\] getReferringAnnotations(URI uri): returns all annotations' URIs that mention the MO with this uri or its data fields (annotation points);

String\[\] getReferringForumPosts(URI uri): returns all forum posts that mention the MO with this uri or its data fields (annotation points); IDs for the forum posts are returned as Strings.