guergana.tzatchkova added a comment.

  The Query Service uses the QueryHelper implementation to generate the GUI of 
the Query.
  
  + QueryHelper
  
  The functions `setQuery` and `getQuery` create the Query from the Visual 
Editor and vice versa.
  
  There is a method to get the i18n labels and put them inside of a span.
  
  The `draw` function creates the elements from the query:
  
  Triples: It extracts the triples and creates a table row for each triple. 
  Limit: there is a getLimitSection
  Variable: there is an isVariable method
  
  + SparqlQuery
  
  is used to separate the query into objects for easier processing of the 
query, some relevant methods are:
  
  getTriples: returns an array with all the triples (only has cases `bgp`, 
`optional` and `union`. 
  findSubqueries: selfexplanatory
  addTriple: adds a triple to the query
  getTripleVariables
  getBoundVariables
  getServices
  getComment: will we use this one? (for comments written in the query. start 
with #)
  
  + QueryTemplate
  
  This codes generates templates if the template code is given as part of the 
query in a comment.
  
  Example:
  
  This query
  
    #TEMPLATE={"template":"Presidents of ?country and their 
spouses","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 
wd:Q6256 . }"} } }
    
    SELECT ?p ?pLabel ?ppicture ?w ?wLabel ?wpicture WHERE {
      BIND(wd:Q30 AS ?country)
      ?country (p:P6/ps:P6) ?p.
      ?p wdt:P26 ?w.
      OPTIONAL {
        ?p wdt:P18 ?ppicture.
        ?w wdt:P18 ?wpicture.
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language 
"[AUTO_LANGUAGE],en". }
    }
  
  Generates this template:
  
    #TEMPLATE={"template":"Presidents of ?country and their 
spouses","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 
wd:Q6256 . }"} } }
    
    SELECT ?p ?pLabel ?ppicture ?w ?wLabel ?wpicture WHERE {
      BIND(wd:Q30 AS ?country)
      ?country (p:P6/ps:P6) ?p.
      ?p wdt:P26 ?w.
      OPTIONAL {
        ?p wdt:P18 ?ppicture.
        ?w wdt:P18 ?wpicture.
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language 
"[AUTO_LANGUAGE],en". }
    }
  
  and looks like this: F33929258: image.png 
<https://phabricator.wikimedia.org/F33929258>

TASK DETAIL
  https://phabricator.wikimedia.org/T266960

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: guergana.tzatchkova
Cc: Addshore, Aklapper, Lydia_Pintscher, Manishsamota, Akuckartz, Nandana, 
Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, 
Scott_WUaS, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to