On 10/29/21 10:11 AM, Thad Guidry wrote:
Hi David and team,

In Yi Liu's tool, Wikidata Property Explorer, I noticed that the query performance could be better ideally.  Currently the query takes about 9 seconds and I'm asking if there might be anything to help reduce that considerably?  Refactoring query for optimization, backend changes, anything you can think of Davd?

SELECT DISTINCT ?prop ?label ?desc ?type (GROUP_CONCAT(DISTINCT ?alias; SEPARATOR = " | ") AS ?aliases) WHERE {
  ?prop (wdt:P31/(wdt:P279*)) wd:Q18616576;
    wikibase:propertyType ?type.
  OPTIONAL {
    ?prop rdfs:label ?label.
    FILTER((LANG(?label)) = "en")
  }
  OPTIONAL {
    ?prop schema:description ?desc.
    FILTER((LANG(?desc)) = "en")
  }
  OPTIONAL {
    ?prop skos:altLabel ?alias.
    FILTER((LANG(?alias)) = "en")
  }
}
GROUP BY ?prop ?label ?desc ?type

Thad
https://www.linkedin.com/in/thadguidry/
https://calendly.com/thadguidry/

_______________________________________________
Wikidata mailing list --wikidata@lists.wikimedia.org
To unsubscribe send an email towikidata-le...@lists.wikimedia.org


Hi Thad,

Don't know what your expectations are, but here are results from our Wikidata instance:

 * Query Solution Page with "Anytime Query" Feature Enabled
   
<https://wikidata.demo.openlinksw.com/sparql?default-graph-uri=http%3A%2F%2Fwww.wikidata.org%2F&query=SELECT+DISTINCT+%3Fprop+%3Flabel+%3Fdesc+%3Ftype+%28GROUP_CONCAT%28DISTINCT+%3Falias%3B+SEPARATOR+%3D+%22+%7C+%22%29+AS+%3Faliases%29+WHERE+%7B%0D%0A++%3Fprop+%28wdt%3AP31%2F%28wdt%3AP279*%29%29+wd%3AQ18616576%3B%0D%0A++++wikibase%3ApropertyType+%3Ftype.%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+rdfs%3Alabel+%3Flabel.%0D%0A++++FILTER%28%28LANG%28%3Flabel%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+schema%3Adescription+%3Fdesc.%0D%0A++++FILTER%28%28LANG%28%3Fdesc%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+skos%3AaltLabel+%3Falias.%0D%0A++++FILTER%28%28LANG%28%3Falias%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A%7D%0D%0AGROUP+BY+%3Fprop+%3Flabel+%3Fdesc+%3Ftype%0D%0A&format=text%2Fx-html%2Btr&timeout=360000&signal_void=on&signal_unconnected=on>
 * Query Solution Page with "Anytime Query" Feature Disabled
   
<https://wikidata.demo.openlinksw.com/sparql?default-graph-uri=http%3A%2F%2Fwww.wikidata.org%2F&query=SELECT+DISTINCT+%3Fprop+%3Flabel+%3Fdesc+%3Ftype+%28GROUP_CONCAT%28DISTINCT+%3Falias%3B+SEPARATOR+%3D+%22+%7C+%22%29+AS+%3Faliases%29+WHERE+%7B%0D%0A++%3Fprop+%28wdt%3AP31%2F%28wdt%3AP279*%29%29+wd%3AQ18616576%3B%0D%0A++++wikibase%3ApropertyType+%3Ftype.%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+rdfs%3Alabel+%3Flabel.%0D%0A++++FILTER%28%28LANG%28%3Flabel%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+schema%3Adescription+%3Fdesc.%0D%0A++++FILTER%28%28LANG%28%3Fdesc%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fprop+skos%3AaltLabel+%3Falias.%0D%0A++++FILTER%28%28LANG%28%3Falias%29%29+%3D+%22en%22%29%0D%0A++%7D%0D%0A%7D%0D%0AGROUP+BY+%3Fprop+%3Flabel+%3Fdesc+%3Ftype%0D%0A&format=text%2Fx-html%2Btr&timeout=0&signal_void=on&signal_unconnected=on>

 * Ditto, but using GRAPH CLAUSE
   
<https://wikidata.demo.openlinksw.com/sparql?default-graph-uri=http%3A%2F%2Fwww.wikidata.org%2F&query=SELECT+DISTINCT+%3Fprop+%3Flabel+%3Fdesc+%3Ftype+%28GROUP_CONCAT%28DISTINCT+%3Falias%3B+SEPARATOR+%3D+%22+%7C+%22%29+AS+%3Faliases%29+%0D%0AWHERE+%7B%0D%0A+++++++GRAPH+%3Fg+%7B%0D%0A++++++++++++++++++++%3Fprop+%28wdt%3AP31%2F%28wdt%3AP279*%29%29+wd%3AQ18616576%3B%0D%0A++++++++++++++++++++++++wikibase%3ApropertyType+%3Ftype.%0D%0A++++++++++++++++++++OPTIONAL+%7B%0D%0A++++++++++++++++++++++++%3Fprop+rdfs%3Alabel+%3Flabel.%0D%0A++++++++++++++++++++++++FILTER%28%28LANG%28%3Flabel%29%29+%3D+%22en%22%29%0D%0A++++++++++++++++++++%7D%0D%0A++++++++++++++++++++OPTIONAL+%7B%0D%0A++++++++++++++++++++++++%3Fprop+schema%3Adescription+%3Fdesc.%0D%0A++++++++++++++++++++++++FILTER%28%28LANG%28%3Fdesc%29%29+%3D+%22en%22%29%0D%0A++++++++++++++++++++%7D%0D%0A++++++++++++++++++++OPTIONAL+%7B%0D%0A++++++++++++++++++++++++%3Fprop+skos%3AaltLabel+%3Falias.%0D%0A++++++++++++++++++++++++FILTER%28%28LANG%28%3Falias%29%29+%3D+%22en%22%29%0D%0A++++++++++++++++++++%7D%0D%0A+++++++%7D%0D%0A%7D%0D%0AGROUP+BY+%3Fprop+%3Flabel+%3Fdesc+%3Ftype%0D%0A&format=text%2Fx-html%2Btr&timeout=0&signal_void=on&signal_unconnected=on>
   -- this might not make a difference here since all the data is in a
   single Named Graph

Hope this helps.

--
Regards,

Kingsley Idehen 
Founder & CEO
OpenLink Software
Home Page:http://www.openlinksw.com
Community Support:https://community.openlinksw.com
Weblogs (Blogs):
Company Blog:https://medium.com/openlink-software-blog
Virtuoso Blog:https://medium.com/virtuoso-blog
Data Access Drivers 
Blog:https://medium.com/openlink-odbc-jdbc-ado-net-data-access-drivers

Personal Weblogs (Blogs):
Medium Blog:https://medium.com/@kidehen
Legacy Blogs:http://www.openlinksw.com/blog/~kidehen/
              http://kidehen.blogspot.com

Profile Pages:
Pinterest:https://www.pinterest.com/kidehen/
Quora:https://www.quora.com/profile/Kingsley-Uyi-Idehen
Twitter:https://twitter.com/kidehen
Google+:https://plus.google.com/+KingsleyIdehen/about
LinkedIn:http://www.linkedin.com/in/kidehen

Web Identities (WebID):
Personal:http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
        
:http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

Reply via email to