I am working on FlashCards app and I want to use json-ld for importing/exporting data from the app. I created simple structure but I am not sure if what I have done is valid and the links between the data are properly set.
- I am not sure if the link between
FlashCardSide:languageandDictionary:availableLanguageis created FlashCardis of typeThing, and I haveFlashCard:containswhich is supposed to be not valid property, still validation passes.- How should I define the types and properties that are not from schema.org
ex:Dictionary,ex:FlashCardSide, - Should I put some json-ld definitions on the site. something like
https://example.com/ontology.jsonld - How should
acceptedValuebe defined
Here is sample of the json-ld:
{
"@context": {
"ex": "https://example.com/",
"schema": "http://schema.org/",
"id": "@id",
"type": "@type",
"Dictionary": "ex:Dictionary",
"Language": "schema:Language",
"FlashCard": "schema:Thing",
"FlashCardSide": "ex:FlashCardSide",
"availableLanguage": "schema:availableLanguage",
"name": "schema:name",
"value": "schema:value",
"description": "schema:description",
"isPartOf": "schema:isPartOf",
"itemListElement": "schema:itemListElement"
},
"id": "ex:dictionary/0117649e-f5af-486e-9d4d-756c335f7e53",
"type": "Dictionary",
"availableLanguage": [
{
"id": "ex:language/norwegian",
"type": "Language",
"name": "norsk"
},
{
"id": "ex:language/english",
"type": "Language",
"name": "english"
}
],
"itemListElement": [
{
"id": "ex:flashcard/0117649e-f5af-486e-9d4d-756c335f7e51",
"type": "FlashCard",
"contains": [
{
"type": "FlashCardSide",
"value": "hund",
"isPartOf": "ex:language/norwegian",
"acceptedValue": ["random-123"],
"description": "<p>additional details</p>"
},
{
"type": "FlashCardSide",
"value": "dog",
"isPartOf": "ex:language/english",
"acceptedValue": ["random-123"],
"description": "<p>additional details</p>"
}
]
},
{
"id": "ex:flashcard/0117649e-f5af-486e-9d4d-756c335f7e52",
"type": "FlashCard",
"contains": [
{
"type": "FlashCardSide",
"value": "eple",
"isPartOf": "ex:language/norwegian",
"acceptedValue": ["random-321"],
"description": "<p>additional details</p>"
},
{
"type": "FlashCardSide",
"value": "apple",
"isPartOf": "ex:language/english",
"acceptedValue": ["random-321"],
"description": "<p>additional details</p>"
}
]
}
]
}
I have tested it with both: https://validator.schema.org/ and https://json-ld.org/playground/ and it appears to be valid.