Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating triple for http://schema.org/workLocation

I am creating a Turtle file which would contain triples for a particular individual of type schema:Person.

I am stuck in defining triples for the person's schema:workLocation. According to the documentation, the range of schema:workLocation includes schema:Place, and a place can have an schema:address which should have type schema:PostalAddress. I've created the following:

@prefix schema: <http://schema.org/> .
<http://www.example.com/ns/person/1> a schema:Person ;
                                     schema:givenName "XXX" ;
                                     schema:familyName "XXXX" ;
                                     schema:addressCountry "USA" .

Is this the right way of describing an address? How do I specify the person's work location?

like image 347
Anubhav Avatar asked Sep 30 '22 06:09

Anubhav


1 Answers

Let's work triple by triple, and then we can consider whether there are ways to clean up the presentation. First, you started with the prefix declaration and identifying a resource with type person:

@prefix schema: <http://schema.org/> .
@prefix : <http://stackoverflow.com/q/24891549/1281433/> .

:person1 a schema:Person .

Next, you want to add a work location. Well, the work location is going to be a thing, and will have either type Place or ContactPoint. Lets assume it's a place. Then we add:

:person1 schema:workLocation :place62 .
:place62 a schema:Place .

Now the place can be related to a PostalAddress by the schema:address property:

:place62 schema:address :address89 .
:address89 a schema:PostalAddress .

Now, there are lots of properties we might use to describe a PostalAddress. In this case, we might have something like (using the sample values from that page):

:address89 schema:addressLocality "Mountain View" .
:address89 schema:addressRegion "CA" .
:address89 schema:postalCode "94043" .
:address89 schema:streetAddress "1600 Amphitheathre Pkwy" .

Now a postal address also works with properties from ContactPoint, so you might want some of those, too, but you can define those in the same way. So now you have this data:

@prefix schema: <http://schema.org/> .
@prefix : <http://stackoverflow.com/q/24891549/1281433/> .

:person1 a schema:Person .
:person1 schema:workLocation :place62 .
:place62 a schema:Place .
:place62 schema:address :address89 .
:address89 a schema:PostalAddress .
:address89 schema:addressLocality "Mountain View" .
:address89 schema:addressRegion "CA" .
:address89 schema:postalCode "94043" .
:address89 schema:streetAddress "1600 Amphitheathre Pkwy" .

Unless you're going to reuse the place and address (which you might, if you're describing a bunch of People at the same location), you probably can use blank nodes instead of URI nodes. Doing that, and using some of the syntactic sugar that Turtle provides, you end up with:

@prefix schema: <http://schema.org/> .
@prefix : <http://stackoverflow.com/q/24891549/1281433/> .

:person1 a schema:Person ;
         schema:workLocation [ a schema:Place ;
                               schema:address [ a schema:PostalAddress ;
                                                schema:addressLocality "Mountain View" ;
                                                schema:addressRegion "CA" ;
                                                schema:postalCode "94043" ;
                                                schema:streetAddress "1600 Amphitheathre Pkwy" ] ] .
like image 74
Joshua Taylor Avatar answered Oct 12 '22 11:10

Joshua Taylor