Talk:Wikidata Query Service/Categories

About this board

Query pages, subcategories and HiddenCategory attributes

1
ZebraApfelschnecke (talkcontribs)

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!

Reply to "Query pages, subcategories and HiddenCategory attributes"
Michael Schönitzer (WMDE) (talkcontribs)
This post was hidden by 73.71.144.171 (history)
Smalyshev (WMF) (talkcontribs)

Fixed, thank you

Can we whitelist the endpoint ?

2
Jheald (talkcontribs)

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.

Smalyshev (WMF) (talkcontribs)

Yes, I've added those to whitelist and they'll be added to the production config after deployment on Monday.

Reply to "Can we whitelist the endpoint ?"
Multichill (talkcontribs)
Smalyshev (WMF) (talkcontribs)

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.

Reply to "Commons"
Viswaprabha (talkcontribs)
  1. mlwiki
Smalyshev (WMF) (talkcontribs)

Added to configs.

There are no older topics
Return to "Wikidata Query Service/Categories" page.