0

I'd like to create an ontology which describe interactions between users in a social network and which I want to import in GraphDB. I have decided to use the vocabulary foaf in order to exploit the resources already defined inside it. I'm creating the ontology's schema and I'm developing the User class as type of foaf:Person, each user has got a string name so I want to add this relation inside user class using foaf:name property.

My question is, since this isn't an instance of a user, what object shall I use in the class description beside the predicate foaf:name?

@prefix : <http://xmlns.com/swp/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/TR/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# BASE INFORMATION

:User a foaf:Person ;
    rdfs:label "User" ;
    rdfs:comment "A person who has got an account" ;
    foaf:name ??? ;
    foaf:title :EducationalQualification .

EDIT I thought that maybe the right object could be xsd:string:

:User a foaf:Person ;
    rdfs:label "User" ;
    rdfs:comment "A person who has got an account" ;
    foaf:name xsd:string ;
    foaf:title :EducationalQualification .
Vladimir Alexiev
  • 2,477
  • 1
  • 20
  • 31
M.Morris
  • 147
  • 1
  • 12
  • 1
    Why is `:User` an instance of `foaf:Person` and not a subclass if you saying *I'm developing the User class*? – UninformedUser Feb 12 '21 at 06:23
  • Actually I didn't thought about the fact that it could be a subclass of person. If I transform the user class as subclass of person should I define the name property inside user class or this relationship is already present in the upper class? I've read the foaf specification and name it isn't a property included in person class. – M.Morris Feb 12 '21 at 08:25
  • why should the class `:User` have a name property at all? I mean, you already have a label assigned, what would be the purpose of `foaf:name` for the class `:User`? In my opinion – and modeling is strongly opinion-based, so don't consider my comments as the only way to go – the instances of class `:User` can have `foaf:name` values, though in RDF nothing is required at all. So in the end, it depends on what you want to do with the data after all – UninformedUser Feb 12 '21 at 10:40
  • 1
    You need to read a basic book (eg the "Working ontologist") and understand the difference between classes and instances. Also "define the name property inside user class" sounds like object-oriented programming, but ontologies are a bit different. You may also want to read up on RDF Shapes, see free book "Validating RDF" – Vladimir Alexiev Feb 12 '21 at 11:35
  • 1
    foaf:name has rdfs:domain owl:Thing, which means it's applicable to any class. To define that your :User must have a name, you need RDF Shapes. – Vladimir Alexiev Feb 12 '21 at 11:37
  • 1
    For social network stuff, you'll find the SIOC and VCARD ontologies useful, in addition to FOAF. – Vladimir Alexiev Feb 12 '21 at 11:38
  • Ok maybe I get the problem. Defining :User as type of :Person, I'm not expanding class :Person but I'm declaring an instance of that class. In order to expand a class I need to declare a subclass of :Person, in this way every property of :Person (and its upper classes) are inherited from sub class :User. Due to inheritation of properties, if one property, as foaf:name, is already present in one of upper classes of :Person it's useless define it one more time inside the sub class :User. – M.Morris Feb 12 '21 at 13:45

1 Answers1

3

I recommend studying the RDF Schema for instructions how to write your own basic vocabulary. You don't need to use any of that, but it is certainly useful for anyone who would like to use or understand your custom vocabulary.

Let's think about the problem domain now. You have users with names and titles. You want your names to be plain strings and your titles to be instances of :EducationalQualification. Let's try to express that, not using but extending FOAF.

First, you want to express that every :User is a foaf:Person. Writing :User a foaf:Person is not correct because it means that a resource identified by :User is a particular instance of a person, which it isn't – it's a class!

:User a rdfs:Class ;
  rdfs:subClassOf foaf:Person .

This is a good definition of your new class – from this someone can infer that users in your dataset can be treated as FOAF persons.

For names of people, I'd argue that rdf:langString (i.e. language-tagged strings) is a better class for names of people, especially if you go with foaf:name, so I will use that (but there is no difference in the usage anyway).

:name a rdf:Property ;
  rdfs:domain :User ;
  rdfs:range rdf:langString ;
  rdfs:subPropertyOf foaf:name .

This is again pretty simple: :name is a property that can (must) be attached to a :User and has (must have) a value of rdf:langString. If any two resources are linked via this property, it implies that they are linked with foaf:name as well (due to the sub-property).

Same for titles:

:title a rdf:Property ;
  rdfs:domain :User ;
  rdfs:range :EducationalQualification ;
  rdfs:subPropertyOf foaf:title .

Your original intention was to express that anything attached via foaf:title to a :User is :EducationalQualification. This can be expressed as well, but you need something stronger than RDFS, like OWL:

@prefix owl: <http://www.w3.org/2002/07/owl#> .

[ a owl:Restriction ;
  owl:onProperty [ owl:inverseOf foaf:title ] ;
  owl:someValuesFrom :User
] rdfs:subClassOf :EducationalQualification .

I don't think this is a good idea however, since it modifies foaf:title in a way that is not expected. It's better to using a specialized property if you have a specialized meaning in mind.

IS4
  • 11,945
  • 2
  • 47
  • 86