   @prefix : <http://www.w3.org/2005/10/23/Atom#> .
   @prefix owl: <http://www.w3.org/2002/07/owl#> .
   @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
   @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
   @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
   @prefix foaf: <http://xmlns.com/foaf/0.1/> .    
   @prefix webarch: <http://sw.nokia.com/WebArch-1/> .
   @prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
   @prefix skos: <http://www.w3.org/2004/02/skos/core> .
   @prefix dc: <http://purl.org/dc/elements/1.1/> .
   @prefix iana: <http://www.iana.org/assignments/relation/> .
   @prefix cifp: <http://eulersharp.sourceforge.net/2004/04test/rogier#>.

    <>   a owl:Ontology, owl:Thing;
         rdfs:comment "The AtomOWL ontology is inspired from the work done by the atom working group. This ontology is working off the spec draft-ietf-atompub-format-11.txt published at http://www.ietf.org/internet-drafts/. I will call this atom11 in this ontology. The AtomOWL ontology uses as much as possible the same terms as the format there to make the relation easy to understand. The AtomOWL name space is slightly different from the atom namespace [see post http://www.imc.org/atom-syntax/mail-archive/msg16476.html]. But this is a good thing as it helps distinguish the ontology from the atom11 serialisation."@en ;
          dc:creator "Henry Story"@en;
          dc:contributor "Reto Bachmann-Gmuer"@en;
          dc:contributor "Danny Ayers"@en;
          dc:created "2005-10-23";
          dc:title "Atom Syndication Ontology"@en;
	  owl:imports <http://xmlns.com/foaf/0.1/index.rdf>;
	  owl:imports <http://www.w3.org/2004/02/skos/core/history/2005-03-31>;
	  owl:imports <http://purl.org/dc/elements/1.1/> .

#meta properties
    
    :retosNote  a owl:AnnotationProperty;
          rdfs:subPropertyOf skos:editorialNote;
          rdfs:comment "A comment by Reto Bachmann-Gmuer"@en.
		
    :dannyNote  a owl:AnnotationProperty; 
          rdfs:subPropertyOf skos:editorialNote;
          rdfs:comment "A comment by Danny Ayers"@en.
    
#
# Classes
#
   :Category     a owl:Class;
         rdfs:label   "a category";
         :retosNote "The construct with term and scheme looks very much like a URI-Ref used in RDF. Isn't this just any rdfs:Resource? Maybe skos:Concept could be used as range of :category."@en;
         rdfs:comment "see 4.2.2 of atom11. A Category Type"@en.
    
   :Content     a owl:Class;
         rdfs:label "content class"@en;
         rdfs:comment "see section 4.1.3 in atom11."@en;
         rdfs:subClassOf webarch:Representation.
    
   :Version   a owl:Class;
         rdfs:comment "Metadata about the state of  a resource with given :id at an :updated time."@en;
	 rdfs:subClassOf [ owl:complementOf :Id ];
         rdfs:subClassOf [
                a owl:Restriction; 
                owl:cardinality "1"^^xsd:int;
                owl:onProperty :id ],
                   [
                a owl:Restriction; 
                owl:cardinality "1"^^xsd:int;
                owl:onProperty :updated ] .
    

    :Entry     a owl:Class;
         rdfs:comment "see section 4.1.2 of the atom11 spec"@en;
         rdfs:subClassOf :Version .

    :Feed  a owl:Class;
         rdfs:comment  "Container for feed metadata."@en;
         rdfs:subClassOf :Version .

    :FeedOrEntry a owl:Class;
         owl:unionOf ( :Entry :Feed );
         rdfs:subClassOf  [
                a owl:Restriction; 
                owl:cardinality "1"^^xsd:int;
                owl:onProperty :title ];
         rdfs:comment "Union of the Feed and Entry class. Simplifies writing the ontology."@en .
            

    :Id  a owl:Class;
         rdfs:comment  "Entries and Feeds have ids that relate the different instances."@en;
         skos:editorialNote "The idea of using a domain of InformationResource is from Reto Backman-Gmur. Comments welcome. It introduces the webarch ontology."@en; 
	 :dannyNote "does webarch:InformationResource have to be dereferenceable?";
	 :retosNote "atom11 speaks in terms of IRI's which are not integrated properly into RDF yet. This means that some information may be lost in the process of converting from atom11 to atomOWL"@en;
            rdfs:subClassOf  webarch:InformationResource .

    :FeedId a owl:Class;
         rdfs:subClassOf :Id;
         rdfs:label      "Feed Id"@en;
         rdfs:comment    "Identifier for Feed things."@en .

    :EntryId  a owl:Class;
         rdfs:subClassOf :Id;
         rdfs:label      "Entry Id"@en;
         rdfs:comment    "Identifier for Entry"@en .
    
     :Generator     a owl:Class;
         :retosNote "is this an instance of the piece of software or the program itself? which is the agent"@en;
         rdfs:label "Generator of feed"@en;
         rdfs:comment "see section 4.2.4 of atom11 spec. Generator for the Feed. It has many properties in common with :Person"@en;
         rdfs:subClassOf foaf:Agent .


     :Link     a owl:Class;
         rdfs:label   "Link Class"@en;
         rdfs:comment "see section 4.2.7 of atom11 spec. It turns out that the link is really just a reified statement in order to add some information, most notably a title to a link. See the rules at the end. "@en;
         rdfs:subClassOf rdf:Statement .
    
     :Person   a owl:Class;
         rdfs:label   "Person class"@en;
         rdfs:comment "see section 3.2 of atom11 spec."@en;
         rdfs:subClassOf foaf:Agent, [
                a owl:Restriction; 
                owl:cardinality "1"^^xsd:int;
                owl:onProperty :email ] .
    
     :RelationType a owl:Class;
         rdfs:subClassOf owl:ObjectProperty;
         rdfs:comment "see section 4.2.7.2 of atom11. Relation types are registered, or can be created as described in the section mentioned of atom11. They are special types of properties that relate the object of a link with the link's href."@en .

 
     :TextContent     a owl:Class;
         rdfs:subClassOf :Content;
         rdfs:subClassOf [
                a owl:Restriction;
                owl:onProperty :type;
                owl:allValuesFrom [ owl:oneOf ( "text/plain"^^xsd:string "text/html"^^xsd:string ) ] 
		].
 
   :PlainTextContent     a owl:Class;
         rdfs:subClassOf :TextContent ;
         rdfs:subClassOf [
                a owl:Restriction;
                owl:onProperty :type;
                owl:hasValue    "text/plain"^^xsd:string ] .

#
# Properties
#
 

# Properties of a Version

    :id   a owl:FunctionalProperty,
         owl:ObjectProperty;
         rdfs:label "id"@en;
         rdfs:comment "See section  4.2.6 atom11 spec. All Versions with the same id can be considered to be versions of the resource identified by the id. Hence the inverse :version relationship."@en;
         rdfs:domain  :Version;
         rdfs:range   :Id .

    :updated     a owl:DatatypeProperty,
                  owl:FunctionalProperty;
         rdfs:label "updated"@en;
         rdfs:comment "See section 4.2.15 of atom11 spec. Indicates the most recent instant in time when a resource ID was modified in a way the publisher considers significant. Therefore, not all modifications necessarily result in a changed atom:updated value."@en;
         rdfs:domain    :Version;
         rdfs:range     xsd:dateTime .

    [] cifp:productProperty ( :updated :id :content);
         a owl:InverseFunctionalProperty;
         rdfs:comment "see last paragraph of §4.1.1 of atom11. There should be only one :Version with the same updated time stamp and id. Any two others are considered to be equivalent."@en;
         skos:editorialNote "Reto has argued well on the atom syntax list that one has to accept that there can be many different language versions of the same resource, all updated simultaneously: http://www.imc.org/atom-syntax/mail-archive/msg17059.html . The syntax can make arbitrary restrictions on what can appear inside an xml file, but the semantics has to take into account that muliple language representations of a feed can exist, and so semantically there can be multiple language entries with the same id that get updated simultaneously. The language restrictions and mime type restrictions are essentially on the content, which is why we have CIFP that includes content. "@en . 




# Properties that are the same across :Feed and :Entry,

   :author   a owl:ObjectProperty;
         rdfs:label "author";
         rdfs:comment "See section  4.2.1 atom11 spec."@en; 
         rdfs:domain :FeedOrEntry;
         rdfs:range :Person .
   
   :category     a owl:ObjectProperty;
         rdfs:comment "See section  4.2.2. A category with which the conainer is associated."@en;
         rdfs:domain :FeedOrEntry;
         rdfs:range :Category .

   :contributor     a owl:ObjectProperty;
         rdfs:label "contributor"@en;
         rdfs:comment "See section  4.2.3 of atom11 spec. Someone who contributed to the Version of the Container."@en; 
         rdfs:domain :FeedOrEntry;
         rdfs:range  :Person .

   :rights   a owl:FunctionalProperty,  
               owl:ObjectProperty;
         rdfs:label  "rights"@en;
         rdfs:comment "See section  4.2.10 of atom11 spec. Rights held over a Version."@en; 
         rdfs:domain :FeedOrEntry;
         rdfs:range  :TextContent .

   :link     a owl:ObjectProperty;
         rdfs:label "link"@en;
         rdfs:comment "See section  4.2.7 of atom11 spec. A link associated with the container. If the link is unreified, we have a relation from the container to some resource"@en; 
         rdfs:subPropertyOf [owl:inverseOf rdf:subject];
         rdfs:domain  :FeedOrEntry;
         rdfs:range   :Link .

   :title     a owl:ObjectProperty;
         rdfs:label "title"@en;
         rdfs:comment "See section 4.2.14. Title of a container"@en;
         skos:editorialNote "Reto argues that a Title should have any content attached to it. One should for example allow picture for people who can't read or audio titles for people who cannot write. This would of course make the semantics be a lot more lax that the atom11 syntax allows. "@en;
         rdfs:domain :FeedOrEntry;
         rdfs:range :TextContent .

         

# Properties specific to :Entry

   :content     a owl:FunctionalProperty,
                  owl:ObjectProperty;
         rdfs:label "content"@en;
         rdfs:comment "See section  4.1.3 of atom11 spec. The content of an Entry"@en;
         rdfs:subPropertyOf webarch:representation;
         rdfs:domain :Entry;
         rdfs:range :Content.

   :published     a owl:DatatypeProperty,
                    owl:FunctionalProperty;
         rdfs:label "publication date"@en;
         rdfs:comment "See section  4.2.9 of atom11 spec. A date associated with an event early in the lifecyle of the subject."@en;
         rdfs:domain :Entry;
         rdfs:range xsd:dateTime .
   
   :source     a owl:ObjectProperty;
         rdfs:label "source feed"@en;
         rdfs:comment "See section 4.2.11 of atom11 spec. The source feed where the entry was found"@en;
         rdfs:domain :Entry;
         rdfs:range :FeedId.

   :summary     a owl:ObjectProperty, owl:FunctionalProperty;
         rdfs:label "summary"@en;
         rdfs:comment "See section 4.2.13 of atom11 spec. A summary of the content of the Entry"@en;
         rdfs:domain :Entry;
         rdfs:range :TextContent .

# Properties specific to :Feed

   :feedId   a owl:FunctionalProperty,
               owl:ObjectProperty;
         rdfs:label  "feed id"@en;
         rdfs:comment "See section  4.1.1 of atom11 spec. The id of the feed."@en; 
         skos:editorialNote "we don't really need this relation. I just want to express that the id of a Feed, should be a FeedId, and not an EntryId. This is because there are some properties that are true of FeedId's (They have update relations to entries for example";
         rdfs:subPropertyOf  :id;
         rdfs:domain  :Feed;
         rdfs:range   :FeedId.

   :generator     a owl:FunctionalProperty,
                    owl:ObjectProperty;
         rdfs:comment "see section 4.2.4 of atom11. The generator of the object"@en;
         skos:editorialNote "The domain should really just be :Version. I don't see why Entries can't have an generator too (especially as atom:entry can be a top level content)."@en;
         rdfs:domain :Feed;
         rdfs:range  :Generator .

    :icon a owl:ObjectProperty;
         rdfs:label   "icon"@en;
         rdfs:comment "see 4.2.5 of atom11. An icon associated with the object"@en;
         skos:editorialNote "The domain should really just be :Version. I don't see why Entries can't have an icon."@en;
         rdfs:domain :Feed;
         rdfs:range foaf:Image.
    
    :logo a owl:ObjectProperty, owl:FunctionalProperty; 
         rdfs:label   "logo"@en;
         rdfs:comment "see 4.2.8 of atom11. An icon associated with the object"@en;
         skos:editorialNote "The domain should really just be :Version. I don't see why Entries can't have a logo too."@en;
         rdfs:domain :Feed;
         rdfs:range foaf:Image.
   
   :subtitle    a owl:ObjectProperty,
                  owl:FunctionalProperty;
         rdfs:label  "subtitle"@en;
         rdfs:comment "see section 4.2.12 of atom11. Subtitle of the feed."@en;
	 rdfs:subPropertyOf :content;
         rdfs:domain :Feed;
         rdfs:range :TextContent .
    
   :entry     a owl:ObjectProperty;
         rdfs:label   "An entry of a Feed"@en;
         rdfs:comment "The feed contains the given Entry. See 4.1.1 of atom11"@en;
         rdfs:domain  :Feed;
         rdfs:range   :Entry.
 
# Properties specific to :Person

    :email a owl:ObjectProperty;
         rdfs:label "email address"@en;
         rdfs:comment "see 3.2.3 of atom11. A mailbox of the Person"@en;
         rdfs:subPropertyOf foaf:mbox .

# properties specific to Generator

    :generatorVersion a owl:DatatypeProperty ; 
         rdfs:label "version"@en;
         rdfs:comment "see 4.2.4 of atom11. Indicates the version of the Generator"@en;
         rdfs:domain :Generator;
         rdfs:range  xsd:string .

# Properties specific to Person and Generator

    :uri a owl:DatatypeProperty ; 
         rdfs:label "a uri"@en;
         rdfs:comment "see 4.2.4 of atom11. A uri associated the Generator"@en;
         rdfs:comment "see 3.2.2 of atom11. A uri associated the Person"@en;
         skos:editorialNote "the uri with subject :Agent and :Generator are really the same relation"@en;
         rdfs:domain [ owl:unionOf ( :Person :Generator ) ];
         rdfs:range  xsd:anyUri . 

    :name a owl:DatatypeProperty;
         rdfs:label "name"@en;
         rdfs:comment "see 3.2.1 of atom11. A human readable name for the Person."@en;
         rdfs:comment "see 4.2.4 of atom11. A name for the Generator. "@en;
         rdfs:domain [ owl:unionOf ( :Person :Generator ) ];
         rdfs:subPropertyOf foaf:name.
    


# Properties on the :Link
# note: the atom11 link properties hreflang, title and length are in fact properties of representations of the href resource 
# which are now properties with domain :Content

    :subject a owl:ObjectProperty;
         rdfs:label  "the object of the link"@en;
         rdfs:comment "the inverse of the :link relation, not specified in atom11, but added here for convenience"@en;
         rdfs:subPropertyOf rdf:subject;
         owl:inverseOf   :link .

    :rel  a owl:ObjectProperty;
         rdfs:label  "relation type"@en;
         rdfs:comment "see 4.2.7.2 of atom11. The relationship type. The relationship type is a property that relates as object the "@en;
         rdfs:subPropertyOf rdf:predicate;
         rdfs:domain  :Link;
         rdfs:range   :RelationType .


   :href     a owl:ObjectProperty,
               owl:FunctionalProperty;
         rdfs:label  "hyperlink reference"@en;
         rdfs:comment "see 4.2.7.1 of atom11."@en;
         rdfs:subPropertyOf rdf:object;
         rdfs:domain :Link; 
         rdfs:range     webarch:InformationResource .
    
   
   :linkTitle   a owl:DatatypeProperty;
         rdfs:label "name of link"@en;
         rdfs:comment "the title of the link as defined by atom11 4.2.7.5. "@en;
	 skos:editorialNote "We could not call this relation :title because of clash with entry and feed title"@en;
         rdfs:domain :Link;
         rdfs:range  xsd:string .
   

   
# Some of the relation types

    iana:alternate  a :RelationType, owl:ObjectProperty ;
         rdfs:label  "alternate relation"@en;
         rdfs:comment "see 4.2.7.2.1 of atom11. The object points to an alternate version of the subject"@en;
         rdfs:domain  :Version .

    iana:related     a :RelationType ;
         rdfs:label  "related"@en;
         rdfs:comment "see 4.2.7.2.2 of atom11. The object points to a related version of the subject. So if the subject is a Entry the object might be a resource with an html representation of that entry."@en;
         rdfs:domain  :Version .

    iana:self        a :RelationType ;
         rdfs:label   "self relation"@en;
         rdfs:comment "see 4.2.7.2.3 of atom11. The object is equivalent to the subject."@en;
         :retosNote   "is this owl:sameAs? or some other well known identity relation?"@en;
         rdfs:domain  :Version .

    iana:enclosure   a :RelationType ;
         rdfs:label  "enclosure relation"@en;
         rdfs:comment "see 4.2.7.2.4 of atom11. The object is a related resource that is potentially large in size and requires special handling."@en;
         rdfs:subPropertyOf iana:alternate .

    iana:via             a :RelationType ;
         rdfs:label  "via relation"@en;
         rdfs:comment "see 4.2.7.2.5 of atom11. The object provided a source of the information found in the subject."@en;
         rdfs:domain  :Version .
    
# Properties of web resources 
# these, especially the type property, point to a very strong similarity 
# between a representation and an atom:content

    [] cifp:productProperty ( :type :string );
         a owl:InverseFunctionalProperty;
         rdfs:comment "A Content is identified by the binary data string and the interpretation of that data (type)."@en ;
	 :retosNote "reto is working on a better abstraction of a representation".

   :type     a owl:DatatypeProperty,
                owl:FunctionalProperty;
         rdfs:label "mime type"@en;
         rdfs:comment "see 4.2.7.3 of atom11. The mime type of the representation."@en;
#         rdfs:subPropertyOf  dc:format;
         rdfs:domain  :Content;
         rdfs:range xsd:string .
 
   :lang     a owl:DatatypeProperty,
               owl:FunctionalProperty;
         rdfs:label "language"@en;
         rdfs:comment "see 4.2.7.4 of atom11. The language of the representation."@en;
         rdfs:domain :Content;
         rdfs:range xsd:language .
 
   :length     a owl:DatatypeProperty,
                 owl:FunctionalProperty;
         rdfs:label "length in bytes"@en;
         rdfs:comment "see 4.2.7.6 of atom11. The length in bytes of the representation."@en;
         rdfs:domain :Content;
         rdfs:range xsd:int .

    :value    a owl:DatatypeProperty,
                owl:FunctionalProperty;
         rdfs:label "bits of the representation"@en;
         rdfs:comment "this is the content as a string"@en;
         :retosNote "How are the bits encoded in a xsd:string?"@en;
         rdfs:domain :Content;
         rdfs:range xsd:string .

    :src       a owl:ObjectProperty;
         rdfs:label "source"@en;
         rdfs:comment "a source of the representation"@en;
         owl:equivalentProperty webarch:representationOf;
         rdfs:domain :Content;
         rdfs:range  webarch:InformationResource .


# Properties on Category
    
    :term     a owl:FunctionalProperty, 
                owl:DatatypeProperty;
         rdfs:label   "term"@en;
         rdfs:comment "see 4.2.2.1 of atom11. Identifies the category"@en;
         skos:editorialNote "should specify that there is exactly one term"@en;
         rdfs:domain :Category;
         rdfs:range xsd:string .
    
    :scheme  a owl:FunctionalProperty,
               owl:ObjectProperty;
         rdfs:label   "catgegorization scheme"@en;
         rdfs:comment "see 4.2.2.2 of atom11. Identifies a categorization scheme."@en; 
         rdfs:domain :Category;
         rdfs:range webarch:InformationResource.

    :label   a owl:FunctionalProperty, 
                     owl:DatatypeProperty;
         rdfs:label    "label"@en;
         rdfs:comment "see 4.2.2.3 of atom11. A Human readable label for display."@en;
         skos:editorialNote "Should this be functional? Given the language sensitivity of the label"@en;
         rdfs:domain :Category;
         rdfs:range xsd:string .

    [] cifp:productProperty ( :term :scheme );
         a owl:InverseFunctionalProperty;
         rdfs:comment "A term and a scheme identify a Category"@en ;
	 skos:editorialNote "The label is language dependent and seems less important"@en .
     
  
# Properties on the Id Constructs       
   
    :version  a owl:ObjectProperty,
              owl:InverseFunctionalProperty;
         rdfs:label    "version of an id resource"@en;
         rdfs:comment  "the inverse of the id relation. The state of an id is always a :Version"@en;
         owl:inverseOf   :id;
         rdfs:domain  :Id;
         rdfs:range  :Version.

    :update     a owl:ObjectProperty;
         rdfs:label   "An entry of a Feed"@en;
         rdfs:comment "The feed has published the given entry"@en;
         rdfs:domain  :FeedId;
         rdfs:range   :Entry.
      

#
# Rules
#


# Move from a document structure towards less of a document structure

 { ?feed a :Feed, :State;
          :id ?feedId;
          :entry ?entry . } => { ?feedId :update ?entry } .


# Link
# danny check spec on reification. Is the rule beloz ok?

    { ?link :subject ?state;  
           :rel ?rel;  
           :href ?obj . } => {  ?state ?rel ?obj . } .  
    
# Content
# The rules below means we are in OWL Full. It may also have some other consequences on the ontology
# that needs to be worked out. http://chatlogs.planetrdf.com/swig/2005-09-28.html#T10-23-21


    { ?content a :Content;
                :type "text/plain";
                :string ?s . } => { ?content = ?s . } .

#cwm.py does not like the rules below
#   { ?content a :Content;
#               :type "text/plain";
#               :lang ?l;
#               :string ?s . } => { ?content = ?s@?l . } . 

#   { ?content a :Content;
#               :type "application/xml";
#               :string ?s . } => { ?content = ?s@rdfs:XMLLiteral . } . 

# any others?


#ENDS
