W3C home > Mailing lists > Public > public-linked-json@w3.org > May 2017

Re: could this json-ld be any simpler than this? (tips for a json-ld noob?)

From: Doug Black Jr. <dblack@americanbible.org>
Date: Tue, 9 May 2017 13:46:06 +0000
To: Darren Cruse <darren.cruse@gmail.com>, "public-linked-json@w3.org" <public-linked-json@w3.org>
Message-ID: <C02F0FA0-4BD8-4F1B-8905-7F145305654D@americanbible.org>
Hi there! Your JSON-LD does not follow the appropriate format. It also depends what you’re trying to accomplish with this schema.

Local Business: https://schema.org/LocalBusiness
Restaurant: https://schema.org/FoodEstablishment
Grocery Store: https://schema.org/GroceryStore
A Product to Sell: https://schema.org/Product

You can also see a created example of the product schema here: http://jsonld.com/product/

For the languages, you can also use the Language type: https://schema.org/Language

Google’s Structured Testing Data Tool is great to use to validate: https://search.google.com/structured-data/testing-tool

Hope this helps! Reply to me specifically if I can help any further.

Douglas Black Jr.
Web Developer
American Bible Society

P: 215-309-0744
101 N. Independence Mall East FL8
Philadelphia, PA 19106-2155
americanbible.org
Get Involved<http://www.americanbible.org/get-involved-with-bible-impact-around-the-globe>

From: Darren Cruse <darren.cruse@gmail.com>
Date: Monday, May 8, 2017 at 9:15 AM
To: "public-linked-json@w3.org" <public-linked-json@w3.org>
Subject: could this json-ld be any simpler than this? (tips for a json-ld noob?)
Resent-From: <public-linked-json@w3.org>
Resent-Date: Tuesday, May 9, 2017 at 7:49 AM

Was seeing if I followed JSON-LD well enough to convert a real simple (but real example from my work) JSON over to JSON-LD.

My goal is literally to keep it as simple as it possibly can be, because if I move forward I will have to sell teammates on the idea who have no semantic web/linked data background at all who will likely be very skeptical of the cost/benefit unless it is.

So atm I'm trying to avoid anything but the minimum needed to wind up with triples I can load into Virtuoso and SPARQL query from there.

My JSON is like so:

{
"crop": {
"Corn": {
"en": "Corn",
"fr": "Blé",
"pt": "Milho"
},
"Soybean": {
"en": "Soybean",
"fr": "Soja",
"pt": "Soja"
}
}
}

And with the help of the playground I came up with the following for my JSON-LD:

{
    "@context": {
        "@base": "https://velocity.ag/field-reference-data/field-reference-data.jsonld",
        "id": "@id",
        "type": "@type",
        "groups": "https://velocity.ag/field-reference-data/groups",
        "name": "https://schema.org/name",
        "refcodes": "https://velocity.ag/field-reference-data/refcodes",
        "code": "http://schema.org/code",
        "label": "https://velocity.ag/field-reference-data/label",
        "en": {
            "@id": "https://velocity.ag/field-reference-data/lang/en",
            "@language": "en"
        },
        "fr": {
            "@id": "https://velocity.ag/field-reference-data/lang/fr",
            "@language": "fr"
        },
        "pt": {
            "@id": "https://velocity.ag/field-reference-data/lang/pt",
            "@language": "pt"
        }
    },
    "id": "all",
    "groups": [{
        "id": "crop",
        "name": "crop",
        "refcodes": [{
                "id": "crop/corn",
                "code": "Corn",
                "label": {
                    "id": "crop/corn/label",
                    "en": "Corn",
                    "fr": "Blé",
                    "pt": "Milho"
                }
            },
            {
                "id": "crop/soybean",
                "code": "Soybean",
                "label": {
                    "id": "crop/soybean/label",
                    "en": "Soybean",
                    "fr": "Soja",
                    "pt": "Soja"
                }
            }
        ]
    }]
}

Does this look reasonable? (this is my first JSON-LD ever would love advice if I've got some things wrong)

And though I'm not terribly unhappy with the above (esp. if I can break the context part out into a separate standalone file and I see that's possible correct)...

Is this as simple as it can be?  Could it have been even simpler e.g. in any way closer to the original JSON?

Thanks appreciate any tips,

Darren

Received on Wednesday, 10 May 2017 09:36:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:49 UTC