You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Fabian Christ <ch...@googlemail.com> on 2011/10/06 17:57:22 UTC

New JSON-LD output

Hi,

I have been working on improving the JSON-LD output provided by Stanbol. The
output is now much cleaner by implementing the latest JSON-LD 1.0 spec. A
major improvement is that the implementation tries to avoid CURIEs
automatically. Below is a snippet from an output of the Stanbol Enhancer.
Web developers who are not interested in the details, can just overlook the
@context part and get the data they want from each @subject by using simple
short property names.

Best,
 - Fabian

{
  "@context": {
    "AdministrativeRegion": "http://dbpedia.org/ontology/AdministrativeRegion",
    "alt": "http://www.w3.org/2003/01/geo/wgs84_pos#alt",
    "Artist": "http://dbpedia.org/ontology/Artist",
    "birthDate": "http://dbpedia.org/ontology/birthDate",
    "comment": "http://www.w3.org/2000/01/rdf-schema#comment",
    "confidence": "http://fise.iks-project.eu/ontology/confidence",
    "created": "http://purl.org/dc/terms/created",
    "creator": "http://purl.org/dc/terms/creator",
    "dbp-ont": "http://dbpedia.org/ontology/",
    "deathDate": "http://dbpedia.org/ontology/deathDate",
    "depiction": "http://xmlns.com/foaf/0.1/depiction",
    "end": "http://fise.iks-project.eu/ontology/end",
    "enhancer": "http://fise.iks-project.eu/ontology/",
    "entity-label": "http://fise.iks-project.eu/ontology/entity-label",
    "entity-reference": "http://fise.iks-project.eu/ontology/entity-reference",
    "entity-type": "http://fise.iks-project.eu/ontology/entity-type",
    "entityRank": "http://www.iks-project.eu/ontology/rick/model/entityRank",
    "extracted-from": "http://fise.iks-project.eu/ontology/extracted-from",
    "foaf": "http://xmlns.com/foaf/0.1/",
    "homepage": "http://xmlns.com/foaf/0.1/homepage",
    "label": "http://www.w3.org/2000/01/rdf-schema#label",
    "language": "http://purl.org/dc/terms/language",
    "lat": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
    "long": "http://www.w3.org/2003/01/geo/wgs84_pos#long",
    "MilitaryUnit": "http://dbpedia.org/ontology/MilitaryUnit",
    "nfo": "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#",
    "Organisation": "http://dbpedia.org/ontology/Organisation",
    "owl": "http://www.w3.org/2002/07/owl#",
    "Person": "http://dbpedia.org/ontology/Person",
    "Place": "http://dbpedia.org/ontology/Place",
    "plainTextContent":
"http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent",
    "populationTotal": "http://dbpedia.org/ontology/populationTotal",
    "relation": "http://purl.org/dc/terms/relation",
    "score": "http://www.iks-project.eu/ontology/rick/query/score",
    "selected-text": "http://fise.iks-project.eu/ontology/selected-text",
    "selection-context":
"http://fise.iks-project.eu/ontology/selection-context",
    "SportsTeam": "http://dbpedia.org/ontology/SportsTeam",
    "start": "http://fise.iks-project.eu/ontology/start",
    "subject": "http://purl.org/dc/terms/subject",
    "Thing": "http://www.w3.org/2002/07/owl#Thing",
    "type": "http://purl.org/dc/terms/type",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "@coerce": {
      "@iri": [
        "entity-reference",
        "entity-type",
        "extracted-from",
        "relation",
        "subject",
        "type",
        "depiction",
        "homepage"
      ],
      "xsd:dateTime": [
        "birthDate",
        "deathDate",
        "created"
      ],
      "xsd:double": [
        "confidence",
        "score",
        "lat",
        "long"
      ],
      "xsd:int": [
        "end",
        "start",
        "alt"
      ],
      "xsd:long": "populationTotal",
      "xsd:string": [
        "selected-text",
        "selection-context",
        "creator"
      ]
    }
  },
  "@subject": [
    {
      "@subject": "http://dbpedia.org/resource/%C3%8Ele-de-France_%28region%29",
      "@type": [
        "dbp-ont:AdministrativeRegion",
        "dbp-ont:Place",
        "dbp-ont:PopulatedPlace",
        "http://www.opengis.net/gml/_Feature",
        "owl:Thing"
      ],
      "comment": "\"Île-de-France is one of the twenty-six
administrative regions of France, composed mostly of the Paris
metropolitan area. Its name literally means \"Island of France\",
possibly from ancient Frankish Liddle Franke, \"little France\".
Created as the \"District of the Paris Region\" in 1961; it was
renamed after the historic province of \"Isle de France\" in 1976,
when its administrative status was aligned with the other French
administrative regions created in 1972.\"@en",
      "depiction":
"http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Rimex-France_location_%C3%8Ele-de-France.svg/200px-Rimex-France_location_%C3%8Ele-de-France.svg.png",
      "entityRank": 0.6049551,
      "homepage": "http://www.iledefrance.fr",
      "label": "\"Île-de-France (bölge)\"@tr",
      "lat": 48.5,
      "long": 2.5,
      "populationTotal": 11694000,
      "score": 12761.78,
      "subject":
"http://dbpedia.org/resource/Category:NUTS_2_statistical_regions_of_the_European_Union"
    },
    {
      "@subject": "http://dbpedia.org/resource/A._R._Rahman",
      "@type": [
        "dbp-ont:Artist",
        "dbp-ont:MusicalArtist",
        "dbp-ont:Person",
        "foaf:Person",
        "owl:Thing"
      ],
      "birthDate": "1966-01-05T23:00:00Z",
      "comment": "\"Allah Rakha Rahman is an Indian film composer,
record producer, musician and singer. His film scoring career began in
the early 1990s. He has won fourteen Filmfare Awards, four National
Film Awards, a BAFTA Award, a Golden Globe, two Grammy Awards, and two
Academy Awards.\"@en",
      "depiction":
"http://upload.wikimedia.org/wikipedia/commons/8/82/AR_Rahman.jpg",
      "entityRank": 0.5520861,
      "homepage": "http://www.arrahman.com",
      "label": "\"A. R. Rahman\"@tr",
      "score": 576.87445,
      "subject": "http://dbpedia.org/resource/Category:1966_births"
    }....



-- 
Fabian
http://twitter.com/fctwitt

Re: New JSON-LD output

Posted by Reto Bachmann-Gmür <re...@apache.org>.
Hi Fabian,

That's good news.

I don't know if and how the json-ld library could be added to apache
commons. For now I've opened CLEREZZA-642 for adding the code there. A patch
would be very welcome :)

Reto

On Thu, Oct 6, 2011 at 6:25 PM, Fabian Christ <ch...@googlemail.com>
wrote:
> Hi Reto,
>
> yes it implements  a Clerezza SerializingProvider if that is what you're
> looking for.
>
> And you're right. The best place for this serializer would be inside
> Clerezza.
>
> Open question is what to do with the JSON-LD implementation. We could
> publish it as a standalone component somewhere else. Perhaps Apache
Commons
> or whatever. Or include it in Clerezza. It has neither dependencies to
> Stanbol nor to Clerezza.
>
> Best,
>  - Fabian
>
> Am Donnerstag, 6. Oktober 2011 schrieb Reto Bachmann-Gmür :
>
>> Hi Fabian
>>
>> Does the serializer implement the clerezza serializer API? If yes I'd
like
>> to add it to Clerezza as it seems to suite well into the standard set of
>> serializers. If not I would be curious why not.
>>
>> Cheers,
>> Reto
>> On Oct 6, 2011 5:57 PM, "Fabian Christ" <christ.fabian@googlemail.com
<javascript:;>
>> >
>> wrote:
>>
>
>
> --
> Fabian
> http://twitter.com/fctwitt
>

Re: New JSON-LD output

Posted by Fabian Christ <ch...@googlemail.com>.
Hi,

However I don't understand why the @context has both a line for the
> ontology prefix:
>
> "db-ont:": "http://dbpedia.org/ontology/",
>
> and then specific type shortnames such as:
>
> "Artist": "http://dbpedia.org/ontology/Artist",
> "MusicalArtist": "http://dbpedia.org/ontology/MusicalArtist",
> "Person": "http://dbpedia.org/ontology/Person",
>
> And then in the payload:
>
>     "@type": [
>       "dbp-ont:Artist",
>       "dbp-ont:MusicalArtist",
>       "dbp-ont:Person",
>       ...
>     ],
>
> Either we use shortnames for types or we use the prefix notation
> without polluting the context whith type shortnames.
>
>
Hmm may be you're right and this could be improved. I will have closer look
tomorrow. Thanks!

Best,
 - Fabian


-- 
Fabian
http://twitter.com/fctwitt

Re: New JSON-LD output

Posted by Olivier Grisel <ol...@ensta.org>.
Looks great. Thanks Fabian.

However I don't understand why the @context has both a line for the
ontology prefix:

"db-ont:": "http://dbpedia.org/ontology/",

and then specific type shortnames such as:

"Artist": "http://dbpedia.org/ontology/Artist",
"MusicalArtist": "http://dbpedia.org/ontology/MusicalArtist",
"Person": "http://dbpedia.org/ontology/Person",

And then in the payload:

     "@type": [
       "dbp-ont:Artist",
       "dbp-ont:MusicalArtist",
       "dbp-ont:Person",
       ...
     ],

Either we use shortnames for types or we use the prefix notation
without polluting the context whith type shortnames.

-- 
Olivier