# I want to ensure that tags are treated somewhat differently to mere 
# "subjects"; they don't necessarily denote the subject of something per se.
# skos:Concept isn't far off, so for interoperability's sake :Tag and 
# :taggedWithTag are tied in to skos:Concept and skos:subject.

# There are two ways to use this ontology.
# 1. Link resources to Tags through :taggedWithTag. Tags use :tagNames to name 
#    themselves; if you wish you can additionally use skos:prefLabel. 
#    
# 2. Link resource to Tags via :Tagging reifications. This allows a tagger, 
#    date, etc. to play a part in the interaction, but is less tied to SKOS.
# 
# (2) is more thorough, but not so simple. Comments are welcome on all aspects
# of this draft, but particularly welcome on things labelled as "testing".
#
# Many thanks go to Danny Ayers (http://dannyayers.com) and Seth Russell 
# (http://bozofaust.blogspot.com) for their already-invaluable insight.
#
#           Richard Newman (http://www.holygoat.co.uk), 2005-03-23

# Update 2005-05-19: rename tagName to name.
# Update 2005-11-27: undo that change!
# Update 2005-12-21: add property inverse and Tagging subclass.

# This ontology.
@prefix :     <http://www.holygoat.co.uk/owl/redwood/0.1/tags/> .
@prefix tags: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/> .

# Stock imports.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .

# Might come in handy.
@prefix del: <http://del.icio.us/> .
# This is where I put my tags.
@prefix tag: <http://www.holygoat.co.uk/owl/redwood/tag/> .

: a owl:Ontology;
  dc:title "Tag ontology"@en ;
  rdfs:label "An ontology for tags."@en ;
  dc:description "An ontology that describes tags, as used in the popular del.icio.us and Flickr systems, and allows for relationships between tags to be described."@en ;
  dct:issued "2005-03-23" ;
  dct:modified "2005-12-21" , "2005-05-19" , "2005-11-27";
  dc:creator "Richard Newman" ;
  dc:contributor "Seth Russell" , "Danny Ayers" ;
  foaf:maker <http://www.holygoat.co.uk/foaf.rdf#RichardNewman> .

:Tag a owl:Class ;
  rdfs:subClassOf skos:Concept ;
  skos:definition "A natural-language concept which is used to annotate another resource."@en ;
  rdfs:label "Tag"@en .

:taggedWithTag a owl:ObjectProperty ;
  rdfs:subPropertyOf skos:subject ;
  rdfs:range :Tag ;
  rdfs:label "tagged with tag"@en ;
  rdfs:comment "Indicates that the subject has been tagged with the object tag. This does not assert by who, when, or why the tagging occurred. For that information, use a reified Tagging resource."@en .

:isTagOf a owl:ObjectProperty ; 
  owl:inverseOf :taggedWithTag ;
  rdfs:domain :Tag ;
  rdfs:label "is tag of"@en ;
  rdfs:comment "Indicates that the subject tag applies to the object resource. This does not assert by who, when, or why the tagging occurred. For that information, use a reified Tagging resource."@en .

:Tagging a owl:Class ;
  rdfs:label "tagging"@en ;
  vs:term_status "testing" ;
  rdfs:comment "A reified class which defines an instance of a tagging by an agent of a resource with one or more tags."@en .

:RestrictedTagging a owl:Class ;
  rdfs:label "restricted tagging"@en ;
  rdfs:comment "A Tagging which has precisely one associated resource, and one associated tag."@en ;
  # We don't use equivalentClass here because we might allow extension or
  # open-world things to apply.
  rdfs:subClassOf :Tagging ,
          [ a owl:Restriction ;
            owl:cardinality 1 ;
            owl:onProperty :taggedResource ] ,
          [ a owl:Restriction ;
            owl:cardinality 1 ;
            owl:onProperty :associatedTag ] .

:tag a owl:ObjectProperty ;
  rdfs:range :Tagging ;
  rdfs:label "tag"@en ;
  rdfs:comment "The relationship between a resource and a Tagging. Note, of course, that this allows us to tag tags and taggings themselves..."@en .

:taggedResource a owl:ObjectProperty ;
  rdfs:domain :Tagging ;
  vs:term_status "testing" ;
  rdfs:label "tagged resource"@en ;
  rdfs:comment "The object is a resource which plays a role in the subject Tagging."@en .

:associatedTag a owl:ObjectProperty ;
  rdfs:domain :Tagging ;
  rdfs:range :Tag ;
  vs:term_status "testing" ;
  rdfs:label "associated tag" ;
  rdfs:comment "The object is a Tag which plays a role in the subject Tagging."@en .

:name a owl:DatatypeProperty ;
  rdfs:domain :Tag ;
  rdfs:subPropertyOf rdfs:label, dc:title ;
  rdfs:label "tag name"@en ;
  rdfs:comment "The name of a tag. Note that we can't relate this to skos:prefLabel because we cannot guarantee that tags have unique labels in a given conceptual scheme. Or can we?"@en .

:tagName a owl:DatatypeProperty ;
  rdfs:domain :Tag ;
  rdfs:subPropertyOf rdfs:label, dc:title ;
  rdfs:label "tag name"@en ;
  rdfs:comment "The name of a tag. Note that we can't relate this to skos:prefLabel because we cannot guarantee that tags have unique labels in a given conceptual scheme. Or can we? DEPRECATED 2005-05-19: redundant 'tag'."@en .

:taggedBy a owl:ObjectProperty ;
  rdfs:domain :Tagging ;
  rdfs:range foaf:Agent ;
  vs:term_status "testing" ;
  rdfs:label "tagged by"@en ;
  rdfs:comment "The object plays the role of the tagger in the subject Tagging."@en .

:taggedOn a owl:DatatypeProperty ;
  rdfs:subPropertyOf dc:date ;
  rdfs:domain :Tagging ;
  vs:term_status "testing" ;
  rdfs:label "tagged on"@en ;
  rdfs:comment "The subject Tagging occurred at the subject time and date."@en .

:relatedTag a owl:ObjectProperty ;
  rdfs:subPropertyOf skos:semanticRelation ;
  rdfs:domain :Tag ;
  rdfs:range :Tag ;
  vs:term_status "testing" ;
  rdfs:label "related tag"@en ;
  rdfs:comment "The two tags are asserted as being related. This might be symmetric, but it certainly isn't transitive."@en .

:equivalentTag a owl:ObjectProperty ;
  rdfs:subPropertyOf owl:sameAs ;
  rdfs:domain :Tag ;
  rdfs:range :Tag ;
  vs:term_status "testing" ;
  rdfs:label "equivalent tag"@en ;
  rdfs:comment "The two tags are asserted to be equivalent --- that is, that whenever one is associated with a resource, the other tag can be logically inferred to also be associated. Be very careful with this. I'm not sure if this should be a subproperty of owl:sameAs."@en .

