Difference between revisions of "SimpleGraph-WikiData"
Jump to navigation
Jump to search
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
{{SimpleGraphModule | {{SimpleGraphModule | ||
|name=WikiData | |name=WikiData | ||
|logo=File:Wikidata-logo-en.svg | |logo=File:Wikidata-logo-en.svg | ||
|modulename=wikidata | |modulename=wikidata | ||
− | |url=https://github.com/Wikidata/Wikidata-Toolkit | + | |systemname=WikiDataSystem |
− | + | |url=https://en.wikipedia.org/wiki/Wikidata | |
+ | |apiname=WikiData Toolkit | ||
+ | |apiurl=https://github.com/Wikidata/Wikidata-Toolkit | ||
|documentation=makes WikiData data available via the Wikidata-Toolki API | |documentation=makes WikiData data available via the Wikidata-Toolki API | ||
|storemode=property | |storemode=property | ||
|viewmode=hidden | |viewmode=hidden | ||
}} | }} | ||
− | = | + | = Example = |
+ | <source lang='java'> | ||
+ | @Test | ||
+ | public void testQueenVictoriaChildren() throws Exception { | ||
+ | // debug=true; | ||
+ | queenVictoria = getQueenVictoria(); | ||
+ | // first try to navigate via Property Id | ||
+ | List<SimpleNode> childrenP40 = queenVictoria.out("P40") | ||
+ | .collect(Collectors.toCollection(ArrayList::new)); | ||
+ | assertEquals(9, childrenP40.size()); | ||
+ | // then via property name | ||
+ | List<SimpleNode> children = queenVictoria.out("child") | ||
+ | .collect(Collectors.toCollection(ArrayList::new)); | ||
+ | assertEquals(9, children.size()); | ||
+ | if (debug) { | ||
+ | children.forEach(child -> child.printNameValues(System.out)); | ||
+ | } | ||
+ | wikiDataSystem.close(); | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | = Links = | ||
+ | * {{Link|target=WikiData}} | ||
+ | * https://github.com/maxlath/wikidata-cli |
Latest revision as of 06:48, 13 December 2018
SimpleGraph WikiData module
The SimpleGraph WikiData module makes WikiData data available via the Wikidata-Toolki API see WikiData Toolkit.
Sources
- System: WikiDataSystem.java
- JUnit-Test: TestWikiDataSystem.java
Example
@Test
public void testQueenVictoriaChildren() throws Exception {
// debug=true;
queenVictoria = getQueenVictoria();
// first try to navigate via Property Id
List<SimpleNode> childrenP40 = queenVictoria.out("P40")
.collect(Collectors.toCollection(ArrayList::new));
assertEquals(9, childrenP40.size());
// then via property name
List<SimpleNode> children = queenVictoria.out("child")
.collect(Collectors.toCollection(ArrayList::new));
assertEquals(9, children.size());
if (debug) {
children.forEach(child -> child.printNameValues(System.out));
}
wikiDataSystem.close();
}