{
// all this to mimic Traqula
"type": "query",
"subType": "select",
"distinct": true,
"variables": [
{
"type" : "term",
"subType": "variable",
"value": "Artwork_1"
}
],
// "order": null,
// change order to mimic sparqljs, but in our case this can be only the first variable in the query
"solutionModifiers": {
"order": {
"type": "solutionModifier",
"subType": "order",
"orderDefs": [
{
"expression": {
"type": "term",
"subType": "variable",
"value": "Artwork_1"
},
// si on a besoin de mettre un DESC
// "descending": true
}
]
},
"limitOffset": {
"type": "solutionModifier",
"subType": "limitOffset",
"limit": 1000
}
},
// change "branches" to "where"
// and this is a single object, not an array. The array is bgpSameSubject
// "branches": [
"where": {
"type" : "pattern",
"subType" : "bgpSameSubject",
"subject": {
// new type variable with an rdf:type
"type": "term",
"subType": "variable",
"value": "Artwork_1",
"rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork"
},
// list of predicate object pairs associated to the same subject declared above
"predicateObjectPairs": [
{
"type": "predicateObjectPair",
"predicate": {
"type": "term",
"subType": "namedNode",
"value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_displayedAt"
},
"object" : {
"type": "objectCriteria",
"variable": {
"type": "term",
"subType": "variable",
"value": "Museum_2",
"rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Museum"
},
// either "values", either "filters", either "predicateObjectPairs"
// here a predicateObjectPair means we have a WHERE associated to the variable declared above
"predicateObjectPairs": [
{
"type": "predicateObjectPair",
// here : if we need to switch optional / notExists this will be a "subType"
// "subType": "optional",
// "subType": "notExists",
"predicate": {
"type": "term",
"subType": "namedNode",
"value": "https://data.mydomain.com/ontologies/sparnatural-config/Museum_country"
},
"object" : {
"termType": "objectCriteria",
"variable": {
"type": "term",
"subType": "variable",
"value": "Country_4",
"rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Country"
},
// we would always have "values", and if we have a single value, we set
// it as the object value instead of a VALUES clause
// fixed values set by "values" clause instead of "filters"
"values": [
{
// something closer to Traqula than to rdfjs here
"type": "term",
"subType" : "namedNode",
"value": "http://dbpedia.org/resource/France",
"label": "France"
},
{
"type": "term",
"subType" : "labelledIri",
"value": "http://dbpedia.org/resource/Italy",
"label": "Italy"
}
]
}
}
]
}
}
{
"type": "predicateObjectPair",
"predicate": {
"type": "term",
"subType": "namedNode",
"value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_author"
},
"object" : {
"type": "objectCriteria",
"variable": {
"type": "term",
"subType": "variable",
"value": "Person_6",
"rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Person"
},
"values": [
{
"type": "term",
"subType" : "namedNode",
"value": "http://dbpedia.org/resource/Leonardo_da_Vinci",
"label": "Leonardo da Vinci"
}
]
}
},
{
"type": "predicateObjectPair",
"predicate": {
"type": "term",
"subType": "namedNode",
"value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_creationYear"
},
"object" : {
"termType": "ObjectCriteria",
"variable": {
"type": "term",
"subType": "variable",
"value": "Date_8",
"rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Date"
},
// here a LabelledFilter, that is a custom filter with a label
// note : fixed literal values, like for a Boolean widget, would go in a "values" clause
"filters": [
{
"type": "labelledFilter",
"label": "between 1800 and 1901",
"filter": {
// here we would have different kind of filters depending on the widget
"type": "numberFilter",
"min": 1800,
"max": 1901
}
}
]
}
}
]
}
}
bgpSameSubjectkind of pattern)LabelledVariablekind of pattern)valuesin the query vs.filters. Any fixed value, be it an IRI or a Literal, would go in avaluesclause and not afiltersclauseTest query
Proposed example structure:
{ // all this to mimic Traqula "type": "query", "subType": "select", "distinct": true, "variables": [ { "type" : "term", "subType": "variable", "value": "Artwork_1" } ], // "order": null, // change order to mimic sparqljs, but in our case this can be only the first variable in the query "solutionModifiers": { "order": { "type": "solutionModifier", "subType": "order", "orderDefs": [ { "expression": { "type": "term", "subType": "variable", "value": "Artwork_1" }, // si on a besoin de mettre un DESC // "descending": true } ] }, "limitOffset": { "type": "solutionModifier", "subType": "limitOffset", "limit": 1000 } }, // change "branches" to "where" // and this is a single object, not an array. The array is bgpSameSubject // "branches": [ "where": { "type" : "pattern", "subType" : "bgpSameSubject", "subject": { // new type variable with an rdf:type "type": "term", "subType": "variable", "value": "Artwork_1", "rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork" }, // list of predicate object pairs associated to the same subject declared above "predicateObjectPairs": [ { "type": "predicateObjectPair", "predicate": { "type": "term", "subType": "namedNode", "value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_displayedAt" }, "object" : { "type": "objectCriteria", "variable": { "type": "term", "subType": "variable", "value": "Museum_2", "rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Museum" }, // either "values", either "filters", either "predicateObjectPairs" // here a predicateObjectPair means we have a WHERE associated to the variable declared above "predicateObjectPairs": [ { "type": "predicateObjectPair", // here : if we need to switch optional / notExists this will be a "subType" // "subType": "optional", // "subType": "notExists", "predicate": { "type": "term", "subType": "namedNode", "value": "https://data.mydomain.com/ontologies/sparnatural-config/Museum_country" }, "object" : { "termType": "objectCriteria", "variable": { "type": "term", "subType": "variable", "value": "Country_4", "rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Country" }, // we would always have "values", and if we have a single value, we set // it as the object value instead of a VALUES clause // fixed values set by "values" clause instead of "filters" "values": [ { // something closer to Traqula than to rdfjs here "type": "term", "subType" : "namedNode", "value": "http://dbpedia.org/resource/France", "label": "France" }, { "type": "term", "subType" : "labelledIri", "value": "http://dbpedia.org/resource/Italy", "label": "Italy" } ] } } ] } } { "type": "predicateObjectPair", "predicate": { "type": "term", "subType": "namedNode", "value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_author" }, "object" : { "type": "objectCriteria", "variable": { "type": "term", "subType": "variable", "value": "Person_6", "rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Person" }, "values": [ { "type": "term", "subType" : "namedNode", "value": "http://dbpedia.org/resource/Leonardo_da_Vinci", "label": "Leonardo da Vinci" } ] } }, { "type": "predicateObjectPair", "predicate": { "type": "term", "subType": "namedNode", "value": "https://data.mydomain.com/ontologies/sparnatural-config/Artwork_creationYear" }, "object" : { "termType": "ObjectCriteria", "variable": { "type": "term", "subType": "variable", "value": "Date_8", "rdfType": "https://data.mydomain.com/ontologies/sparnatural-config/Date" }, // here a LabelledFilter, that is a custom filter with a label // note : fixed literal values, like for a Boolean widget, would go in a "values" clause "filters": [ { "type": "labelledFilter", "label": "between 1800 and 1901", "filter": { // here we would have different kind of filters depending on the widget "type": "numberFilter", "min": 1800, "max": 1901 } } ] } } ] } }