Index generation specification
Now our goal is to build a djangoldp-based package which builds the meta-index and index files on runtime base on our research project by @lecoqlibre in INRIA, for that we could also provide by default an instance entry point similar to a user WebID at root URI https://your-instance-domain.com/
, which returns the list of both available public containers/catalogs and indexes looking as follows.
{
"@context": {
"ex": "https://example.org#",
"ns1": "https://cdn.startinblox.com/owl/ttl/vocab.ttl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"ldp": ".....",
"dcat": "....."
},
"@graph": [
{
"@id": "https://api.test-inria-index.startinblox.com/",
"@type": "solid:Application"
},
{
"@id": "https://api.test-inria-index.startinblox.com/indexes/",
"@type": "ex:Index"
},
{
"@id": "https://api.test-inria-index.startinblox.com/users/",
"@type": [
"dcat:Dataset",
"ldp:Container"
]
},
{
"@id": "https://api.test-inria-index.startinblox.com/projects/",
"@type": [
"dcat:Dataset",
"ldp:Container"
]
},
{
"@id": "https://api.test-inria-index.startinblox.com/circles/",
"@type": [
"dcat:Dataset",
"ldp:Container"
]
},
{
"@id": "https://api.test-inria-index.startinblox.com/events/",
"@type": [
"dcat:Dataset",
"ldp:Container"
]
},
{
"@id": "https://api.test-inria-index.startinblox.com/resources/",
"@type": [
"dcat:Catalog",
"ldp:Container"
]
}
]
}
As per our last demonstration of the INRIA collaboration project, the traversal search entry point is the meta-index file of the instance:
{
"@context": {
"ex": "https://example.org#",
"ns1": "https://cdn.startinblox.com/owl/ttl/vocab.ttl#",
"ex:forProperty": { "@type": "@id" },
"ex:forValue": { "@type": "@id" },
"ex:instancesIn": { "@type": "@id" }
},
"@graph": [
{
"@id": "https://api.test-inria-index.startinblox.com/indexes/users/",
"@type": "ex:Index"
},
{
"@id": "https://api.test-inria-index.startinblox.com/indexes/users/skills/",
"@type": "ex:PropertyIndexRegistration",
"ex:forProperty": "ex:forProperty",
"ex:forValue": "ns1:hasSkill",
"ex:instancesIn": "https://api.test-inria-index.startinblox.com/indexes/users/skills/"
},
{
"@id": "https://api.test-inria-index.startinblox.com/indexes/users/cities/",
"@type": "ex:PropertyIndexRegistration",
"ex:forProperty": "ex:forProperty",
"ex:forValue": "ns1:hasLocation",
"ex:instancesIn": "https://api.test-inria-index.startinblox.com/indexes/users/cities/"
}
]
}
Which in this case states that we can find an index of known skills on this instance at URI: https://api.test-inria-index.startinblox.com/indexes/skills.jsonld, and same for known cities. If we look at the skills index example:
{
"@context": {
"ex": "https://example.org#",
"ns1": "https://cdn.startinblox.com/owl/ttl/vocab.ttl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"ex:forProperty": {
"@type": "@id"
},
"ex:forValue": {
"@type": "@id"
},
"rdfs:seeAlso": {
"@type": "@id"
}
},
"@graph": [
{
"@id": "http://localhost:8000/indexes/users/skills/",
"@type": "ex:Index"
},
{
"@id": "http://localhost:8000/indexes/users/skills/#1",
"@type": "ex:PropertyIndexRegistration",
"ex:forProperty": "ns1:hasSkill",
"ex:forValue": "http://localhost:8000/skills/1/",
"rdfs:seeAlso": "http://localhost:8000/indexes/users/skills/php/"
},
{
"@id": "http://localhost:8000/indexes/users/skills/#2",
"@type": "ex:PropertyIndexRegistration",
"ex:forProperty": "ns1:hasSkill",
"ex:forValue": "http://localhost:8000/skills/2/",
"rdfs:seeAlso": "http://localhost:8000/indexes/users/skills/javascript/"
}
]
}
This meta-index tells us that the index file where we can find the list of users having the skills PHP is located at URI: http://localhost:8000/indexes/skills/php.jsonld, as a property rdfs:seeAlso of the index instance.
Example of the file listing users having the skill PHP:
{
"@context": {
//TO BE COMPLETED
"ex": "https://example.org#",
"ns1": "https://cdn.startinblox.com/owl/ttl/vocab.ttl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"ex:forProperty": {
"@type": "@id"
},
"ex:forValue": {
"@type": "@id"
},
"rdfs:seeAlso": {
"@type": "@id"
}
},
"@type": "ex:PropertyIndex",
"ex:forProperty": "ns1:hasSkill",
"ex:forValue": "http://localhost:8000/skills/1/",
"@id": "http://localhost:8000/indexes/users/skills/php/",
"rdfs:label": "PHP",
"ex:instance": [
"http://localhost:8000/users/balessan/",
"http://localhost:8000/users/benito/",
"http://localhost:8000/users/balessanvir/"
]
}
Here we can see that users which profiles are available at URIs:
- http://localhost:8000/users/balessan/
- http://localhost:8000/users/benito/
- http://localhost:8000/users/balessanvir/
Have listed PHP as one of their skills.
Let's say we would like to add support for indexes generation by default on djangoldp, indexes being in that case build from django views. Could also be added in a djangoldp-index package ?
Or even more specialised, if we consider that the indexes are business-oriented (client-to-client), we should have the users indexes implemented in a dedicated djangoldp-users-indexes. Or the other way around, we have a djangoldp-skill, this package alread add support for skills to the user model, it should also bear the associated indexes views ? But then it should allow to modify the /users/ endpoint to add a relation the the indexes it adds ?
Here is the specification and a lot of questions it raises.
So to have support for current indexes as specified by @lecoqlibre, we should process as is:
-
For every instantiated models, we should automatically associate a view/viewset at the model/indexes/ IRI -
This IRI should return the list of available indexes (or the content of the indexes directly) associated with the model -
The list of available indexes should be configurable -
How to specify that for the user model I'd like to index them by the 2 or 3 first letters of the name / lastname ? -
How to specify that for the user model I'd also like to index them by skills and/or city ? -
The idea is to avoid having a specific djangoldp-account-index package for instance which would take care of that
-
-
Should the IRI of the indexes be standardized too ? -
Like we could have model/indexes/city/ (users/indexes/city/, users/indexes/skills/)
-
- 3 views to add in djangoldp:
-
The root /
view should return a JSON-LD as shown in first example -
The /indexes/
should return the list of available sub indexes -
The /indexes/__modelname__/
should return the meta-index as shown in the second example for /users/-
It should be based on a new meta called indexes = ['specify fields here']
-
We probably need to provide default indexing classes to build the indexes following a few different patterns -
We need in the future a way to override those default indexing classes
-
-
- The indexes themselves should be public, but the content should be filtered depending on the authenticated user. Please apply permissions !
Ping @sylvain and @lecoqlibre for brainstorming.
Questions: About the skills indexes URI slug: "rdfs:seeAlso": "http://localhost:8000/indexes/users/skills/php/"
How should the related skills be referenced when the targeted resources could be ?
- https://api.hubl.world/skills/324/
- http://dbpedia.org/resource/PHP
- http://data.europa.eu/esco/skill/4350c38d-0fe9-4ca7-bab9-40ed7f72b04f
Should it be: http://localhost:8000/indexes/users/skills/{https://api.hubl.world/skills/324/}/ with https://api.hubl.world/skills/324/ being URL encoded ?