维基数据查询 Service/Categories:pages/subcategories 和 HiddenCategory 属性的数量
Wikidata Query Service/Categories: number of pages/subcategories and HiddenCategory attributes
使用维基数据的 gas:service or mediawiki:categoryTree 服务 API 是否可以通过某种方式在查询结果中包含 mediawiki:pages、mediawiki:subcategories 和 mediawiki:HiddenCategory 属性?我在转储中看到这些属性,但没有运气尝试以编程方式访问它们(使用 SPARQL 或其他一些 API)...
您只需添加您的条件,例如为页面添加:
?out mediawiki:pages ?pages .
结果
{
"out" : {
"type" : "uri",
"value" : "https://en.wikipedia.org/wiki/Category:Fictional_ducks"
},
"depth" : {
"datatype" : "http://www.w3.org/2001/XMLSchema#int",
"type" : "literal",
"value" : "1"
},
"pages" : {
"datatype" : "http://www.w3.org/2001/XMLSchema#integer",
"type" : "literal",
"value" : "113"
}
他们警告您无法通过 UI 访问此内容,因此您需要对查询进行编码并将其传递到 URL:https://query.wikidata.org/bigdata/namespace/categories/sparql?query=&format=json
完整查询:
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
prefix mediawiki: <https://www.mediawiki.org/ontology#>
SELECT * 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.
}
?out mediawiki:pages ?pages .
} ORDER BY ASC(?depth)
使用维基数据的 gas:service or mediawiki:categoryTree 服务 API 是否可以通过某种方式在查询结果中包含 mediawiki:pages、mediawiki:subcategories 和 mediawiki:HiddenCategory 属性?我在转储中看到这些属性,但没有运气尝试以编程方式访问它们(使用 SPARQL 或其他一些 API)...
您只需添加您的条件,例如为页面添加:
?out mediawiki:pages ?pages .
结果
{
"out" : {
"type" : "uri",
"value" : "https://en.wikipedia.org/wiki/Category:Fictional_ducks"
},
"depth" : {
"datatype" : "http://www.w3.org/2001/XMLSchema#int",
"type" : "literal",
"value" : "1"
},
"pages" : {
"datatype" : "http://www.w3.org/2001/XMLSchema#integer",
"type" : "literal",
"value" : "113"
}
他们警告您无法通过 UI 访问此内容,因此您需要对查询进行编码并将其传递到 URL:https://query.wikidata.org/bigdata/namespace/categories/sparql?query=&format=json
完整查询:
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
prefix mediawiki: <https://www.mediawiki.org/ontology#>
SELECT * 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.
}
?out mediawiki:pages ?pages .
} ORDER BY ASC(?depth)