-
Notifications
You must be signed in to change notification settings - Fork 41
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
User Story : parameterized queries #592
Labels
Comments
tfrancart
added
kind: Idea for later 💡
Maybe one day...
what: JSON query
JSON query format loading and saving
labels
May 14, 2024
I. A new webcomponent<spar-natural-form
src="config.ttl"
query="query.json"
form="form.json"
/> II. The form configuration fileform.json : {
"bindings": [
{
"variable" : "Country_4",
"node" : {
"type" : "UserPrompt",
"name" : {
"en" : "Country",
"fr" : "Pays"
}
}
},
{
"variable" : "Person_10",
"node" : {
"type" : "UserPrompt",
"name" : {
"en" : "Author",
"fr" : "Auteur"
}
}
}
]
} III. The query json file (saved from Sparnatural)query.json: {
"distinct": true,
"variables": [
{
"termType": "Variable",
"value": "Artwork_1"
},
{
"termType": "Variable",
"value": "Country_4"
},
{
"termType": "Variable",
"value": "Image_6"
}
],
"order": null,
"branches": [
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#displayedAt",
"o": "Museum_2",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Museum",
"values": []
},
"children": [
{
"line": {
"s": "Museum_2",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#country",
"o": "Country_4",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Museum",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Country",
"values": []
},
"children": []
}
]
},
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#thumbnail",
"o": "Image_6",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Image",
"values": []
},
"children": [],
"optional": true
},
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#description",
"o": "Text_8",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Text",
"values": []
},
"children": [],
"optional": true
},
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#author",
"o": "Person_10",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Person",
"values": []
},
"children": [],
"optional": true
}
]
} IV The generated formIV The final querySi l'utilisateur saisi seulement le pays mais pas l'auteur, alors:
Requête JSON finale: {
"distinct": true,
"variables": [
{
"termType": "Variable",
"value": "Artwork_1"
},
{
"termType": "Variable",
"value": "Country_4"
},
{
"termType": "Variable",
"value": "Image_6"
}
],
"order": null,
"branches": [
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#displayedAt",
"o": "Museum_2",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Museum",
"values": []
},
"children": [
{
"line": {
"s": "Museum_2",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#country",
"o": "Country_4",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Museum",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Country",
"values": [
{
"label": "France (3987)",
"rdfTerm": {
"type": "uri",
"value": "http://fr.dbpedia.org/resource/France"
}
}
]
},
"children": []
}
]
},
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#thumbnail",
"o": "Image_6",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Image",
"values": []
},
"children": [],
"optional": true
},
{
"line": {
"s": "Artwork_1",
"p": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#description",
"o": "Text_8",
"sType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Artwork",
"oType": "http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Text",
"values": []
},
"children": [],
"optional": true
}
]
} V We could use other inputs than user formsPar exemple pour positionner une variable à la date du jour, ou par un bout de script: {
"bindings": [
{
"variable" : "Country_1",
"node" : {
"type" : "UserPrompt",
"name" : {
"en" : "Select a country",
"fr" : "Sélectionner un pays"
}
}
},
{
"variable" : "Date_2",
"node" : {
"type" : "DynamicValueProvider",
"valueProvider" : "TypescriptClassNameOfTheValueProvider"
}
}
]
} |
This would greatly fit our use of sparnatural for the GRACEFUL17 project! |
Hopefully this development could be done end of 2024. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The goal is to create query templates, and indicate which variables in this query template could be choosed by a user. Then users can be proposed with very simple forms containing only these variables to select, without having to redesign the entire query.
This opens the possibility to offer multiple simple forms to end-users, using the same value selection widgets as in Sparnatural.
The story is the following:
VocBench actually has this functionnality:
end-user selects a value:
@antoine37120
The text was updated successfully, but these errors were encountered: