@prefix : <https://w3id.org/won/message#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/won/message> .

<https://w3id.org/won/message> rdf:type owl:Ontology ;
                                owl:versionIRI <https://w3id.org/won/message/1.0> ;
                                owl:imports <https://w3id.org/won/core/1.0> ;
                                <http://purl.org/dc/elements/1.1/abstract> """This ontology is used to model the Message objects central to the Web of Needs. Messages are entities that encapsulate addressing information, signing information, and optionally, content in an RDF dataset. A message is identified by a URI in the URI space on the WoN node it was created on. 

A message consists of graphs that can conceptually contain other graphs; thus the message dataset conceptually is a tree of graphs, which can either be envelope graphs, holding addressing information and signatures, or content graphs, holding arbitrary content.

If a message is sent to another Atom, a new Message URI is minted on that Atom's WoN node and the message copied into the new Message's dataset."""@en ;
                                <http://purl.org/dc/elements/1.1/creator> "Fabian Salcher" ,
                                                                          "Florian Kleedorfer" ,
                                                                          "Yana Panchenko" ;
                                <http://purl.org/dc/elements/1.1/title> "Web of Needs Message Ontology"@en ;
                                <http://purl.org/dc/terms/created> "2013-12-13"^^xsd:date ;
                                <http://purl.org/dc/terms/license> <https://creativecommons.org/licenses/by/4.0/> ;
                                <http://purl.org/vocab/vann/preferredNamespacePrefix> "msg" .

#################################################################
#    Annotation properties
#################################################################

###  http://purl.org/dc/elements/1.1/abstract
<http://purl.org/dc/elements/1.1/abstract> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/elements/1.1/creator
<http://purl.org/dc/elements/1.1/creator> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/elements/1.1/date
<http://purl.org/dc/elements/1.1/date> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/elements/1.1/description
<http://purl.org/dc/elements/1.1/description> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/elements/1.1/title
<http://purl.org/dc/elements/1.1/title> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/terms/created
<http://purl.org/dc/terms/created> rdf:type owl:AnnotationProperty .


###  http://purl.org/dc/terms/license
<http://purl.org/dc/terms/license> rdf:type owl:AnnotationProperty .


###  http://purl.org/vocab/vann/preferredNamespacePrefix
<http://purl.org/vocab/vann/preferredNamespacePrefix> rdf:type owl:AnnotationProperty .


#################################################################
#    Object Properties
#################################################################

###  https://w3id.org/won/message#atom
:atom rdf:type owl:ObjectProperty ;
      rdfs:domain :Message ;
      rdfs:range <https://w3id.org/won/core#Atom> ;
      rdfs:comment "Links the message to its atom. Only used for messages directed at an atom, such as msg:Activate, msg:Deactivate, or msg:AtomHintMessage."@en ;
      rdfs:isDefinedBy <https://w3id.org/won/message> ;
      rdfs:label "atom" .


###  https://w3id.org/won/message#connection
:connection rdf:type owl:ObjectProperty ;
            rdfs:domain :Message ;
            rdfs:range <https://w3id.org/won/core#Connection> ;
            rdfs:comment "Links the message to its connection. Only used for response messages in a connection; the messages sent by either side of the connection use msg:senderSocket and msg:recipientSocket to identify the connection uniquely"@en ;
            rdfs:isDefinedBy <https://w3id.org/won/message> ;
            rdfs:label "connection" .


###  https://w3id.org/won/message#containsSignature
:containsSignature rdf:type owl:ObjectProperty ;
                   rdfs:domain :EnvelopeGraph ;
                   rdfs:range :Signature ;
                   rdfs:comment "Links an envelope to a signature it 'contains'."@en ;
                   rdfs:label "containsSignature" .


###  https://w3id.org/won/message#content
:content rdf:type owl:ObjectProperty ;
         rdfs:domain :Message ;
         rdfs:range :ContentGraph ;
         rdfs:comment "Points to an RDF graph URI that contains the message payload."@en ;
         rdfs:isDefinedBy <https://w3id.org/won/message> ;
         rdfs:label "content" .


###  https://w3id.org/won/message#envelope
:envelope rdf:type owl:ObjectProperty ;
          rdfs:domain :Message ;
          rdfs:range :EnvelopeGraph ;
          rdfs:comment "Links a message to its envelope."@en ;
          rdfs:label "envelope" .


###  https://w3id.org/won/message#hintTargetAtom
:hintTargetAtom rdf:type owl:ObjectProperty ;
                rdfs:comment "The target Atom of the AtomHintMessage. By sending this message, the sender wants to express that the Atom's owner may want to establish a connection with the targetAtom (but first must choose a suitable pair of sockets), or that the targetAtom may just be interesting for the owner for other reasons."@en ;
                rdfs:label "hintTargetAtom" .


###  https://w3id.org/won/message#hintTargetSocket
:hintTargetSocket rdf:type owl:ObjectProperty ;
                  rdfs:comment "The target Socket of a SocketHintMessage. By sending this message it is suggested to establish a connection between the recipientSocket and the targetSocket."@en ;
                  rdfs:label "hintTargetSocket" .


###  https://w3id.org/won/message#messageType
:messageType rdf:type owl:ObjectProperty ;
             rdfs:domain :Message ;
             rdfs:range :MessageType ;
             rdfs:comment "Indicates the type of the message."@en ;
             rdfs:isDefinedBy <https://w3id.org/won/message> ;
             rdfs:label "messageType" .


###  https://w3id.org/won/message#previousMessage
:previousMessage rdf:type owl:ObjectProperty ;
                 rdfs:domain :Message ;
                 rdfs:range :Message ;
                 rdfs:comment "Links a message to an earlier one."@en ;
                 rdfs:label "previousMessage" .


###  https://w3id.org/won/message#recipient
:recipient rdf:type owl:ObjectProperty ;
           rdfs:domain :Message ;
           rdfs:range :Socket ;
           rdfs:comment "Indicates the recipient socket of the message."@en ;
           rdfs:isDefinedBy <https://w3id.org/won/message> ;
           rdfs:label "recipientSocket" .


###  https://w3id.org/won/message#respondingTo
:respondingTo rdf:type owl:ObjectProperty ;
              rdfs:domain :Message ;
              rdfs:range :Message ;
              rdfs:comment "Links a SuccessResponse or a FailureResponse to the message it is responding to."@en ;
              rdfs:label "respondingTo" .


###  https://w3id.org/won/message#respondingToMessageType
:respondingToMessageType rdf:type owl:ObjectProperty ;
                         rdfs:domain :Message ;
                         rdfs:range :MessageType ;
                         rdfs:comment "Used in a response message to indicate the messageType of the original message."@en ;
                         rdfs:label "respondingToMessageType" .


###  https://w3id.org/won/message#sender
:sender rdf:type owl:ObjectProperty ;
        rdfs:domain :Message ;
        rdfs:range :Socket ;
        rdfs:comment "Indicates the sender socket of the message."@en ;
        rdfs:isDefinedBy <https://w3id.org/won/message> ;
        rdfs:label "senderSocket" .


###  https://w3id.org/won/message#signature
:signature rdf:type owl:ObjectProperty ;
           rdfs:domain :Message ;
           rdfs:range :Signature ;
           rdfs:comment "Links a message to its signature."@en ;
           rdfs:label "signature" .


###  https://w3id.org/won/message#signedGraph
:signedGraph rdf:type owl:ObjectProperty ;
             rdfs:domain :Signature ;
             rdfs:range :MessageGraph ;
             rdfs:comment "Links a signature to the graph it signs."@en ;
             rdfs:label "signedGraph" .


###  https://w3id.org/won/message#signer
:signer rdf:type owl:ObjectProperty ;
        rdfs:domain :Signature ;
        rdfs:range :Atom ;
        rdfs:comment "Links a signature to its signer."@en ;
        rdfs:label "signer" .


#################################################################
#    Data properties
#################################################################

###  https://w3id.org/won/message#hash
:hash rdf:type owl:DatatypeProperty ;
      rdfs:domain :Signature ;
      rdfs:range xsd:string ;
      rdfs:comment "The message hash."@en ;
      rdfs:label "hash" .


###  https://w3id.org/won/message#hintScore
:hintScore rdf:type owl:DatatypeProperty ;
           rdfs:domain :Message ;
           rdfs:range xsd:float ;
           rdfs:comment "Score of the Hint, indicating how well-suited the sender of the Hint thinks it is for the recipient. Must be in the range of 0.0 (worst) and 1.0 (best)."@en ;
           rdfs:label "hintScore" .


###  https://w3id.org/won/message#protocolVersion
:protocolVersion rdf:type owl:DatatypeProperty ;
                 rdfs:domain :Message ;
                 rdfs:range xsd:string ;
                 rdfs:comment "Protocol version the message adheres to."@en ;
                 rdfs:label "protocolVersion" .


###  https://w3id.org/won/message#publicKeyFingerprint
:publicKeyFingerprint rdf:type owl:DatatypeProperty ;
                      rdfs:domain :Signature ;
                      rdfs:range xsd:string ;
                      rdfs:comment "The fingerprint of the sender's public key (SHA-256 hash)." ;
                      rdfs:label "publicKeyFingerprint" .


###  https://w3id.org/won/message#timestamp
:timestamp rdf:type owl:DatatypeProperty ;
           rdfs:domain :Message ;
           rdfs:range xsd:long ;
           rdfs:comment "Holds the timestamp assigned when the message was created, as obtained by the local system clock."@en ;
           rdfs:label "receivedTimestamp" .


#################################################################
#    Classes
#################################################################

###  https://w3id.org/won/core#Atom
<https://w3id.org/won/core#Atom> rdf:type owl:Class .


###  https://w3id.org/won/core#Connection
<https://w3id.org/won/core#Connection> rdf:type owl:Class .


###  https://w3id.org/won/core#Node
<https://w3id.org/won/core#Node> rdf:type owl:Class .


###  https://w3id.org/won/message#Atom
:Atom rdf:type owl:Class .


###  https://w3id.org/won/message#ContentGraph
:ContentGraph rdf:type owl:Class ;
              rdfs:subClassOf :MessageGraph ;
              rdfs:comment "The class of graphs that hold user-defined content."@en ;
              rdfs:label "ContentGraph" .


###  https://w3id.org/won/message#EnvelopeGraph
:EnvelopeGraph rdf:type owl:Class ;
               rdfs:subClassOf :MessageGraph ;
               rdfs:comment "Used to define the type of an RDF graph URI so as to explicitly mark it as an envelope graph. An Envelope contains the addressing information."@en ;
               rdfs:isDefinedBy <https://w3id.org/won/message> ;
               rdfs:label "EnvelopeGraph" .


###  https://w3id.org/won/message#FromExternal
:FromExternal rdf:type owl:Class ;
              rdfs:subClassOf :Message ;
              rdfs:comment "A Message received from another WoN node." ;
              rdfs:label "FromExternal" .


###  https://w3id.org/won/message#FromOwner
:FromOwner rdf:type owl:Class ;
           rdfs:subClassOf :Message ;
           rdfs:comment "A Message generated by an Atom's owner." ;
           rdfs:label "FromOwner" .


###  https://w3id.org/won/message#FromSystem
:FromSystem rdf:type owl:Class ;
            rdfs:subClassOf :Message ;
            rdfs:comment "A Message generated by the WoN node (i.e., the 'System')." ;
            rdfs:label "FromSystem" .


###  https://w3id.org/won/message#Message
:Message rdf:type owl:Class ;
         rdfs:comment "Superclass for messages. They fall into three categories: FromOwner, FromSystem and FromExternal." ;
         rdfs:label "Message" .


###  https://w3id.org/won/message#MessageGraph
:MessageGraph rdf:type owl:Class ;
              rdfs:comment "An RDF graph that belongs to a Message"@en ;
              rdfs:label "MessageGraph" .


###  https://w3id.org/won/message#MessageType
:MessageType rdf:type owl:Class ;
             rdfs:comment "Class containing all WoN message types."@en ;
             rdfs:isDefinedBy <https://w3id.org/won/message> ;
             rdfs:label "MessageType" .


###  https://w3id.org/won/message#ResponseType
:ResponseType rdf:type owl:Class ;
              rdfs:subClassOf :MessageType ;
              rdfs:comment "Indicates the (success/error) state of a response message."@en ;
              rdfs:isDefinedBy <https://w3id.org/won/message> ;
              rdfs:label "ResponseType" .


###  https://w3id.org/won/message#Signature
:Signature rdf:type owl:Class .


###  https://w3id.org/won/message#Socket
:Socket rdf:type owl:Class .


#################################################################
#    Individuals
#################################################################

###  https://w3id.org/won/message#ActivateMessage
:ActivateMessage rdf:type owl:NamedIndividual ,
                          :MessageType ;
                 rdfs:comment "Type of message that activates an Atom."@en ;
                 rdfs:isDefinedBy <https://w3id.org/won/message> ;
                 rdfs:label "ActivateMessage" .


###  https://w3id.org/won/message#AtomCreatedNotificationMessage
:AtomCreatedNotificationMessage rdf:type owl:NamedIndividual ,
                                         :MessageType ;
                                rdfs:comment "Type of message sent from a WoN Node to indicate that an Atom has been created."@en ;
                                rdfs:isDefinedBy <https://w3id.org/won/message> ;
                                rdfs:label "AtomCreatedNotificationMessage" .


###  https://w3id.org/won/message#AtomHintMessage
:AtomHintMessage rdf:type owl:NamedIndividual ,
                          :MessageType ;
                 rdfs:comment "Type of message sent by a matching service to an Atom in order to inform its owner of other Atoms possibly interesting for establishing a connection, or just generally of interest."@en ;
                 rdfs:isDefinedBy <https://w3id.org/won/message> ;
                 rdfs:label "AtomHintMessage" .


###  https://w3id.org/won/message#AtomMessage
:AtomMessage rdf:type owl:NamedIndividual ,
                      :MessageType ;
             rdfs:comment """Message sent between an atom's owner and the WoN node hosting the atom. The message is informative only
                   and has no side effect The message is not routed to any other participant."""@en ;
             rdfs:isDefinedBy <https://w3id.org/won/message> ;
             rdfs:label "AtomMessage" .


###  https://w3id.org/won/message#ChangeNotificationMessage
:ChangeNotificationMessage rdf:type owl:NamedIndividual ,
                                    :MessageType ;
                           rdfs:comment "Type of message sent from a WoN Node to indicate that the remote Atom has changed."@en ;
                           rdfs:isDefinedBy <https://w3id.org/won/message> ;
                           rdfs:label "ChangeNotificationMessage" .


###  https://w3id.org/won/message#CloseMessage
:CloseMessage rdf:type owl:NamedIndividual ,
                       :MessageType ;
              rdfs:comment "Type of message that closes a Connection."@en ;
              rdfs:isDefinedBy <https://w3id.org/won/message> ;
              rdfs:label "CloseMessage" .


###  https://w3id.org/won/message#ConnectMessage
:ConnectMessage rdf:type owl:NamedIndividual ,
                         :MessageType ;
                rdfs:comment "Type of message that is sent from Atom A to Atom B in order to create a new Connection."@en ;
                rdfs:isDefinedBy <https://w3id.org/won/message> ;
                rdfs:label "ConnectMessage" .


###  https://w3id.org/won/message#ConnectionMessage
:ConnectionMessage rdf:type owl:NamedIndividual ,
                            :MessageType ;
                   rdfs:comment "Message sent via an established connection. This type is to be used in Socket-specific protocols."@en ;
                   rdfs:isDefinedBy <https://w3id.org/won/message> ;
                   rdfs:label "ConnectionMessage" .


###  https://w3id.org/won/message#CreateMessage
:CreateMessage rdf:type owl:NamedIndividual ,
                        :MessageType ;
               rdfs:comment "Type of message sent to a WoN Node in order to create a new Atom."@en ;
               rdfs:isDefinedBy <https://w3id.org/won/message> ;
               rdfs:label "CreateMessage" .


###  https://w3id.org/won/message#DeactivateMessage
:DeactivateMessage rdf:type owl:NamedIndividual ,
                            :MessageType ;
                   rdfs:comment "Type of message that deactivates an Atom."@en ;
                   rdfs:isDefinedBy <https://w3id.org/won/message> ;
                   rdfs:label "DeactivateMessage" .


###  https://w3id.org/won/message#FailureResponse
:FailureResponse rdf:type owl:NamedIndividual ,
                          :ResponseType ;
                 rdfs:comment "Indicates an error occurred while processing the message."@en ;
                 rdfs:isDefinedBy <https://w3id.org/won/message> ;
                 rdfs:label "FailureResponse" .


###  https://w3id.org/won/message#OpenMessage
:OpenMessage rdf:type owl:NamedIndividual .


###  https://w3id.org/won/message#ReplaceMessage
:ReplaceMessage rdf:type owl:NamedIndividual ,
                         :MessageType ;
                rdfs:comment "Type of message sent to a WoN Node in order replace an Atom's content."@en ;
                rdfs:isDefinedBy <https://w3id.org/won/message> ;
                rdfs:label "ReplaceMessage" .


###  https://w3id.org/won/message#Signature
:Signature rdf:type owl:NamedIndividual .


###  https://w3id.org/won/message#SocketHintMessage
:SocketHintMessage rdf:type owl:NamedIndividual ,
                            :MessageType ;
                   rdfs:comment "Type of message sent by a matching service to the Socket of an Atom in order to inform its owner of the Socket of another Atom possibly interesting for establishing a connection."@en ;
                   rdfs:label "SocketHintMessage" .


###  https://w3id.org/won/message#SuccessResponse
:SuccessResponse rdf:type owl:NamedIndividual ,
                          :ResponseType ;
                 rdfs:comment "Indicates that the message was processed successfully."@en ;
                 rdfs:isDefinedBy <https://w3id.org/won/message> ;
                 rdfs:label "SuccessResponse" .


#################################################################
#    Annotations
#################################################################

:Signature rdfs:comment "Class of all signatures in WoN."@en ,
                        "The class of RDF signatures as used in WoN."@en ;
           rdfs:isDefinedBy <https://w3id.org/won/message> ;
           rdfs:label "Signature" .


#################################################################
#    General axioms
#################################################################

[ rdf:type owl:AllDisjointClasses ;
  owl:members ( :EnvelopeGraph
                :Message
                :MessageType
                :ResponseType
              )
] .


[ rdf:type owl:AllDifferent ;
  owl:distinctMembers ( :ActivateMessage
                        :AtomHintMessage
                        :AtomMessage
                        :ChangeNotificationMessage
                        :CloseMessage
                        :ConnectMessage
                        :ConnectionMessage
                        :CreateMessage
                        :DeactivateMessage
                        :FailureResponse
                        :OpenMessage
                        :ReplaceMessage
                        :SocketHintMessage
                        :SuccessResponse
                      )
] .


[ rdf:type owl:AllDifferent ;
  owl:distinctMembers ( :ActivateMessage
                        :AtomHintMessage
                        :AtomMessage
                        :ChangeNotificationMessage
                        :CloseMessage
                        :ConnectMessage
                        :ConnectionMessage
                        :CreateMessage
                        :DeactivateMessage
                        :FailureResponse
                        :OpenMessage
                        :ReplaceMessage
                        :SuccessResponse
                      )
] .


###  Generated by the OWL API (version 5.1.9) https://github.com/owlcs/owlapi/
