SimpleGraph-WikiData

From BITPlan Wiki
Jump to navigation Jump to search

SimpleGraphModule

Wikidata-logo-en.svg

SimpleGraph WikiData module

The SimpleGraph WikiData module makes WikiData data available via the Wikidata-Toolki API see WikiData Toolkit.

Sources

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();
}

Links