Re: Schema. org Actions best encoding practices

On 30 July 2014 08:29, Adrian Giurca <giurca@tu-cottbus.de> wrote:
> Dear Schema.org community,
>
> We develop a SW application using Schema ontology as data model.  As we
> started in the early stages of Schema development, we used actions from our
> own namespace. However, actually, Schema developed a large set of Actions
> and we would like to align our data to this model.
>
> A typical example, is "John eat a cake", encoded as
>
> {
>   "@context": "http://schema.org",
>   "@type": "EatAction",
>   "agent": {
>     "@type": "Person",
>     "name": "John"
>   },
>   "object": {
>     "@type": "Product",
>     "name": "Cake"
>   }
> }
>
>  I wonder what is the best practice to encode "John eat a cake and drink a
> cola".

Is the goal to describe two different Action instances without
duplicating the description of the Person, John?

I think something like this works in JSON-LD (reversing the direction
of 'agent' so it can be at the top of the tree):

{
    "@context": "http://schema.org",
    "@type": "Person",
    "name": "John",
    "@reverse": {
        "agent": [
            {
                "@type": "DrinkAction",
                "object": {
                    "@type": "Product",
                    "name": "Coke"
                }
            },
            {
                "@type": "EatAction",
                "object": {
                    "@type": "Product",
                    "name": "Cake"
                }
            }
        ]
    }
}


According to the JSON-LD playground tool (
http://json-ld.org/playground/ ), this results in the following
graph/triples:

_:b0 <http://schema.org/name> "John" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/Person> .
_:b1 <http://schema.org/agent> _:b0 .
_:b1 <http://schema.org/object> _:b2 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/DrinkAction> .
_:b2 <http://schema.org/name> "Coke" .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/Product> .
_:b3 <http://schema.org/agent> _:b0 .
_:b3 <http://schema.org/object> _:b4 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/EatAction> .
_:b4 <http://schema.org/name> "Cake" .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/Product> .

Dan

Received on Wednesday, 30 July 2014 08:05:35 UTC