Jump to content

Talk:Wikidata Query Service/Categories

Add topic
From mediawiki.org

Dumps requested

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


  1. mlwiki Viswaprabha (talk) 00:51, 19 September 2017 (UTC)Reply
Added to configs. Smalyshev (WMF) (talk) 06:36, 21 September 2017 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Commons

[edit]

Very nice to see this up and running Stas!. I don't see Wikimedia Commons at https://noc.wikimedia.org/conf/categories-rdf.dblist . Could you please add it? It's the wiki I most often query in Petscan. Multichill (talk) 20:26, 21 September 2017 (UTC)Reply

I've not added commons yet to the list because commons category list is huge, so I want to make sure the system works smoothly first. After this is ensured, we can add commons too. Smalyshev (WMF) (talk) 20:55, 21 September 2017 (UTC)Reply

Can we whitelist the endpoint ?

[edit]

Hi User:Smalyshev (WMF) !

Could we add the categories/sparql endpoint to the whitelist allowed for federation, so that it would be possible to make queries like

PREFIX gas: <http://www.bigdata.com/rdf/gas#>
prefix mediawiki: <https://www.mediawiki.org/ontology#> 

SELECT ?out ?depth WHERE {
    service <https://query.wikidata.org/bigdata/namespace/categories/sparql> {
        SELECT ?out ?depth WHERE {    
            SERVICE gas:service {
                gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.BFS" .
                gas:program gas:linkType mediawiki:isInCategory .
                gas:program gas:traversalDirection "Reverse" .
                gas:program gas:in <https://en.wikipedia.org/wiki/Category:Ducks>. # one or more times, specifies the initial frontier.
                gas:program gas:out ?out . # exactly once - will be bound to the visited vertices.
                gas:program gas:out1 ?depth . # exactly once - will be bound to the depth of the visited vertices.
                gas:program gas:maxIterations 8 . # optional limit on breadth first expansion.
           }
       }
   }
} ORDER BY ASC(?depth)

Try it!

or

prefix mediawiki: <https://www.mediawiki.org/ontology#> 

SELECT ?out ?depth WHERE {
    service <https://query.wikidata.org/bigdata/namespace/categories/sparql> {
        SELECT ?out ?depth WHERE {    
            SERVICE mediawiki:categoryTree {
                bd:serviceParam mediawiki:start <https://en.wikipedia.org/wiki/Category:Ducks> .
                bd:serviceParam mediawiki:direction "Reverse" .
                bd:serviceParam mediawiki:depth 5 .
            }
        }
    }
} ORDER BY ASC(?depth)

Try it!

Thanks! I have some people on en-wiki who would really like some Listeria pages for a set of queries, with articles in one particular category excluded. If federation were enabled, this ought to do the trick perfectly. Jheald (talk) 11:02, 21 February 2018 (UTC)Reply

Yes, I've added those to whitelist and they'll be added to the production config after deployment on Monday. Smalyshev (WMF) (talk) 21:08, 23 February 2018 (UTC)Reply
[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


The link in the introduction (https://noc.wikimedia.org/conf/categories-rdf.dblist) is dead. Michael Schönitzer (WMDE) (talk) 17:05, 12 March 2018 (UTC)Reply

Fixed, thank you Smalyshev (WMF) (talk) 17:19, 12 March 2018 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Query pages, subcategories and HiddenCategory attributes

[edit]

Hi, is it possible to include mediawiki:pages, mediawiki:subcategories and mediawiki:HiddenCategory attributes in query results using gas:service or mediawiki:categoryTree services?

I see these attributes in dumps, but have no luck with accessing them from SPARQL queries so far...

Thank you very much in advance! ZebraApfelschnecke (talk) 10:31, 8 June 2020 (UTC)Reply