Online Presence Ontology - How To
On this page we explain how you can describe some basic things related to Online Presence, using the OPO.
Custom Message
On many social networks and microblogging services users publish short messages called status messages or sometimes custom messages. Here we present a way to semanticaly describe a user's custom message using OPO. Let us first suppose that we want to represent a custom message declared by a user on his Facebook profile or posted as a Twitter post. First we have to describe a user whose presence we want to represent. For this we use the class foaf:Agent from the FOAF Vocabulary. We create an instance #Milstan, and specify its foaf:mbox as mailto:milan.stankovic@gmail.com in order to uniquely identify it. Then we create an instance of sioc:Post (and we call it #myCustomMessage) to represent our custom message, and declare the text of the custom message as sioc:content of the sioc:Post. Further on, we create an instance of the opo:OnlinePresence, called #MyCurrentPresence and specify its properties opo:customMessage (the message we have just created) and opo:startTime (the time when the message was published). Finally we assign #MyCurrentPresence to the Agent #Milstan using the property opo:declaresOnlinePresence.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix sioc: <http://rdfs.org/sioc/ns#>.
:Milstan rdf:type foaf:Agent;
foaf:mbox <mailto:milan.stankovic@gmail.com>.
:myCustomMessage rdf:type sioc:Post;
sioc:content "going to have fun".
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:customMessage :myCustomMessage;
opo:startTime "2008-03-01T18:51:19".
:Milstan opo:declaresOnlinePresence :MyCurrentPresence.
If the data about our example user as a foaf:Agent is already declared somewhere (for example in his FOAF file) we don't have to declare it again. We can just reuse it referring to the user by his URI (for example http://ggg.milanstankovic.org/foaf.rdf#milstan)
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix sioc: <http://rdfs.org/sioc/ns#>.
:myCustomMessage rdf:type sioc:Post;
sioc:content "going to have fun".
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:customMessage :myCustomMessage;
opo:startTime "2008-03-01T18:51:19".
<http://ggg.milanstankovic.org/foaf.rdf#milstan> opo:declaresOnlinePresence :MyCurrentPresence.
Online Status
If we want to declare the user's presence on an IM platform, we usally want to specify his Online Status. Here is the example that shows how to do it. First we define an opo:OnlineStatus called #MyOnlineStatus and describe it in terms of opo:OnlineStatusComponents as opo:Active (the user is currently present on the service), opo:Available (as opposed to busy), opo:Visible (the user does not hide), and opo:ConstrainedContactability (not everyone is allowed to contact this user). Then we create an opo:OnlinePresence, called #MyCurrentPresence, specify the time when it was declared and define it in terms of opo:OnlinePresenceComponents. We want to say that our user allows notifications from applications, so we assign the opo:AllNotificationsPass component to #MyCurrentPresence. We also assign it the opo:PubliclyFindable component to specify that user's contact details are findable in public listings. Most importantly, we add the previously defined #MyOnlineStatus to #MyCurrentPresence. Finally we state that our user declares #MyCurrentPresence.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
:MyOnlineStatus rdf:type opo:OnlineStatus;
opo:hasStatusComponent opo:Active, opo:Available, opo:Visible, opo:ConstrainedContactability.
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:startTime "2008-03-01T18:51:19";
opo:hasPresenceComponent opo:AllNotificationsPass, opo:PubliclyFindable, :MyOnlineStatus.
<http://ggg.milanstankovic.org/foaf.rdf#milstan> opo:declaresOnlinePresence :MyCurrentPresence.
If we assign URIs to opo:OnlineStatuses their descriptions could be reused like the descriptions of foaf:Agents (as showed in the previous example). Reusable descriptions of opo:OnlineStatuses for Skype and GTalk can be found in documents skype.n3 and gTalk.n3.
Current Location
Using the opo:currentLocation property we can discribe the users current location. For specifying location data we use the SpatialThing concept from the WGS84 Ontology. Here is an example how to do it: we first create an istance os SpatialThing concept from the WGS84 Ontology (we call the instance #myFlat) and describe it in terms of latitude and longitude. Then we create an instance of opo:OnlinePresence and asing this Spatial Thing as current location using the property opo:currentLocation.
@base <http://online-presence.net/opo/examples#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#>.
@prefix sioc: <http://rdfs.org/sioc/ns#>.
:MyFlat rdf:type wgs84_pos:SpatialThing;
wgs84_pos:lat 48.858323471538;
wgs84_pos:long 2.29451715946198.
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:customMessage [ rdf:type opo:StatusMessage;
sioc:content "hating SNCF"];
opo:startTime "2008-03-01T18:51:19";
opo:currentLocation :MyFlat.
<http://ggg.milanstankovic.org/foaf.rdf#milstan> opo:declaresOnlinePresence :MyCurrentPresence.
Apart from specifying your location using (lat/long) coordinates, you can also reuse some geographic locations already defined in Geonames or elsewhere. This is especially useful in cases when you want to relate your presence to a specific geographical entity (e.g., Paris, Eiffel Tower) rather than just any coordinates. Since Geonames data is largely used this practice would also make query answering easier (comparing if two URIs are the same rather than doing some coordinates / distance matching to determine if two people are in the same city).
We demonstrate this approach in the following example where the location is specified using Geonames URI for Paris.
@base <http://online-presence.net/opo/examples#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:customMessage [ rdf:type opo:StatusMessage;
sioc:content "hating SNCF"];
opo:startTime "2008-03-01T18:51:19";
opo:currentLocation <http://sws.geonames.org/2988507/>.
<http://ggg.milanstankovic.org/foaf.rdf#milstan> opo:declaresOnlinePresence :MyCurrentPresence.
Sharing Space - Dedicating Presence Information to a Certain Audience
In our user studies we discovered the need to specify the intended audience of presence information (e.g. status messages, availability information, etc.). Users sometimes need to broadcast different status messages to different groups of friends (e.g. one message to closest personal friends and another to work colleagues). The same stands for availability for chat, whereas users would sometimes like to be available just for a particular group of friends (e.g. direct coworkers), and busy for all the others. The concept opo:SharingSpace provides a way to direct the presence information to its intended audience, through a property opo:intededFor.
In the following example we show a status message that the user wants to dedicate to his friends living in Paris, who might be interested to go on a concert together with him. Since the status message shares local event invitation, it might be seen as a noise for people from other places. Therefore, a way to direct it to its targeted audience could be highly useful.
@base <http://online-presence.net/opo/examples#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix opo: <http://online-presence.net/opo/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
:myFriendsInParis rdf:type opo:SharingSpace.
:myCustomMessage rdf:type opo:StatusMessage;
sioc:content "I have two tickets for a concert tonight. Anybody interested?".
:MyCurrentPresence rdf:type opo:OnlinePresence;
opo:startTime "2008-03-01T18:51:19";
opo:customMessage :myCustomMessage;
opo:inendedFor :myFriendsInParis.
opo:SharingSpace is in fact a subclass of foaf:Group and its members can be conveniently defined using SPARQL queries. A SPARQL query defining the members of the opo:SharingSpace used in previous example is shown in the following block of code. It finds all the friends of a particular user who live in Paris (we use the GeoNames URI for Paris), and creates a corresponding Sharing Space.
PREFIX opo: <http:// http://online-presence.net/opo/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT
{
<http://example.org/ns#myFriendsInParis> rdf:type opo:SharingSpace;
foaf:member ?person.
}
WHERE
{
?person foaf:based_near < http://sws.geonames.org/2988507/>.
<http://ggg.milanstankovic.org/foaf.rdf#milstan> foaf:knows ?person.
For more examples of SharingSpace definitions, please see this page.



