-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive index map of index maps #826
Comments
Without going into your examples too far, you might look at Nested Properties which an allow nesting at arbitrary depth. |
Nested properties require that I know their names and define them explicitly in the I can achieve it using Property-based data indexing via Specification can be extended to model my case by allowing array values for {
"@context": {
"mapWith2LevelsAndSemanticKeys": {
"@id": "...",
"@container": "@index",
"@index": ["schema:firstLevelKey", "schema:secondLevelKey"] // this already tells JSON-LD processor that map has 2 levels
},
}
} If keys at certain levels can be ignored (have no semantic meaning), this could also be modelled by placing {
"@context": {
"mapWithFourLevels": {
"@id": "...",
"@container": "@index",
"@index": [null, "schema:secondLevelKey", null, "schema:fourthLevelKey"] // skip keys on level 1 and 3
},
}
} |
Real-life example: For instance, Here is a simplified example of an API description with a single-level map {
"paths": {
"/registration": {
"post": "registers user",
"delete": "deletes account"
},
"/login": {
"post": "login",
"delete": "logout"
}
},
"callbacks": {
"Registration Callback": {
"/onRegistration": {
"post": "called when registered",
"delete": "called when account is deleted"
}
},
"Login Callback": {
"/onLogin": {
"post": "when logged in"
},
"/onLogout": {
"post": "when logged out"
}
}
}
} |
@grenik sadly at this point, I don't think JSON-LD can support that structure. You'd need to convert it into something with less "implied"/structural semantics. @gkellogg this is certainly a common case in human-facing JSON (well...YAML...) formats like OpenAPI, so I do wonder what it would take to support it. Everything I can imagine right now looks rather odd in the context definition, but maybe there's a way we could explore for doing multiple "stacked" indexes somehow. Something fun to explore, anyhow. 😀 |
Is there a way to model map of maps?
I see only single-level maps: Property-based data indexing
But maps often have 2+ levels of indexing. Simplified example: animals are indexed by the size, and then by the color.
expansion result:
The text was updated successfully, but these errors were encountered: