compared with
Current by Vladimir Alexiev
on Feb 25, 2013 15:48.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (19)

View Page History

Jira tasks:
- {jira:RS-541} Discussion
- {jira:RS-1175} Overall
- {jira:RS-1176} Spec

h1. Tags Data Model
Tags in RS come from two places:
- General thesauri.
Any thesaurus with rso:isTag=1 (marked as "t" in [Meta-Thesaurus and FR Names#Meta-thesaurus table|Meta-Thesaurus and FR Names#Meta-thesaurus table]) can be used as a source of tags
- Dedicated thesaurus.
A special RS Tags thesaurus ([http://www.researchspace.org/thesaurus/tag]). New tags are added here
h2. Tags Ontology

We use the [Tags Ontology|http://www.holygoat.co.uk/projects/tags/] ([tags.n3|http://www.holygoat.co.uk/owl/redwood/0.1/tags/tags.n3]), which defines:
- class tags:Tag as a subclass of skos:Concept. (This is perfect: when a skos:Concept is applied as a tag, it becomes tags:Tag.)
- two inverse properties (tags:taggedWithTag and tags:isTagOf) to relate any resource to a tag

The Tags ontology is depicted here:
@prefix rs-tag: <http://www.researchspace.org/thesaurus/tag/> .

rs-tag:1234 a tags:Tag, skos:Concept; skos:inScheme rs-tag:; skos:prefLabel "Watercolor".
?obj tags:taggedWithTag rkd-artist:Rembrandt, rs-tag:1234.
rkd-artist:Rembrandt tags:isTagOf ?obj.
rs-tag:1234 tags:isTagOf ?obj.
{noformat}

Design notes:
- tags.n3 will be loaded on next repo reload
- we use tags:isTagOf instead of tags:taggedWithTag, though they are inferred from each other as inverses
- the type tags:Tag is used to generate the counter for the next tag (in the above case would be 1235)
-- it is inferred from any of tags:isTagOf, tags:taggedWithTag

h1. Tags Use Cases

Because of the limited effort in RS3.6, some viable cases are listed under [#Future Use Cases].


h3. Search by tag

- Clicking on a tag runs a search by that Tag, for that entity kind only
- In the Search dialog for every entity kind, there's a Tags section to add tags to the search

h2. Future Use Cases

- Universal search (of any kind of object) by tag
- Apply/create tag using twitter notation in rich-text: #tag

h1. Tags UI

Use visual design as per [Data Basket UI design#View Bookmark]: gray rounded tags, extra autocomplete text-box


h1. Tags API
- Saves tag to OWLIM: URI saveTag(String label, URI objURI);
- Assign tag to an object: void addTagToObj(URI tagURI, URI objURI);
- Gets tags for an object: Tag[] getTags(URI uriObj, String sort, String filter, String filtVal);
- Deletes any statements that has been created for the tag: void deleteTag(URI tagUri);
- Delete only statements(IS_TAG_OF) that has been created for the tag and the object: void deleteTagFromObj(URI tagUri, URI objUri);
- autocomplete

- Saves tag to OWLIM: URI saveTag(String label, URI thesaurusURI, URI objURI);
if thesaurusURI is null then it saves by default rs-tag(class RSConstants.RST_TAG) specified above;
if objURI is null then it saves the tag only;
- Assign tag to an object: void assignTagToObj(URI tagURI, URI objURI);
- Gets tags for an object: Tag\[\] getTags(URI uriObj);
- Deletes any statements that has been created for the tag: void removeTag(URI tagUri);
- Delete only statements(IS_TAG_OF) that has been created for the tag and the object: void removeTagFromObj(URI tagUri, URI objUri);
- Autocomplete Search tags into existing thesauruses: public Tag\[\] searchThesaurusTags(String searchVal)

TODO Jana & Svetoslav

- When to save tags? Cannot be immediately, because if you're adding tags on a new object, it does not exist until Save. Must be on Save, therefore the Tags API better have assignTagsToObject not addTagToObject and removeTagFromObject
- when saving to the dedicated thesaurus, make URL from the name
eg prefLabel = "water color" \-> URL = rs-tags:water_color

h1. Tags autocomplete - updating Lucene index with new values (design)

- We need an autocomplete on isTag thesauri
- We don't update or delete tags, we only add new ones
- the dedicated rs-tags: thesaurus (where new tags are added) is not searchable.
Many other isTag thesauri are searchable (in fact isSearchable => isTag because all searchable thesauri are interesting for tagging)
- Need to see new entries almost immediately in GUI
- We can differentiate between the search and tags autocomplete calls But it's preferred that the same FTS index be used in both cases
- If possible, implement this with OWLIM 5.3's incremental FTS indexing