Skip to content

Commit

Permalink
modified: README.md
Browse files Browse the repository at this point in the history
- added GTAA examples

modified:   src/main/java/nl/knaw/huc/di/nde/recipe/OpenSKOS.java
- also fetch scopeNote and definition
  • Loading branch information
menzowindhouwer committed Nov 30, 2018
1 parent 2f0c9c7 commit c60930e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ mvn build
$ mvn "-Dexec.args=-Dnde.config=`pwd`/conf/termennetwerk.xml -classpath %classpath nl.knaw.huc.di.nde.Main" -Dexec.executable=java org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
```

or via docker
or via docker:

```sh
$ docker build -t nde-termennetwerk .
Expand All @@ -23,14 +23,22 @@ $ docker run --rm -it -p 8080:8080 nde-termennetwerk

## Queries

The GraphIQL endpoint is hardwired to the NDE Termennetwerk GraphQL endpoint and supports autocomplete.
The GraphiQL endpoint is hardwired to the NDE Termennetwerk GraphQL endpoint and supports autocomplete.

Example query:
Example queries:

```graphql
query { terms(match:"Abkhazian",dataset:"clavas") {uri, altLabel} }
query { terms(match:"*Dutch*",dataset:"clavas") {uri, prefLabel} }
```

```graphql
query {
terms(match:"*fietsen*" dataset:"gtaa") {uri prefLabel altLabel}
}
```

or via curl:

```sh
$ curl -XPOST -H 'Content-Type:application/graphql' -d 'query { terms(match:"Abkhazian",dataset:"clavas") {uri, altLabel} }' http://localhost:8080/nde/graphql
```
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/nl/knaw/huc/di/nde/recipe/OpenSKOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public List<TermDTO> fetchMatchingTerms(XdmItem config, String match) {
for (Iterator<XdmItem> lblIter = Saxon.xpathIterator(item, "skos:altLabel",null, OpenSKOS.NAMESPACES); lblIter.hasNext();) {
term.altLabel.add(lblIter.next().getStringValue());
}
term.definition = new ArrayList<>();
for (Iterator<XdmItem> lblIter = Saxon.xpathIterator(item, "skos:definition",null, OpenSKOS.NAMESPACES); lblIter.hasNext();) {
term.definition.add(lblIter.next().getStringValue());
}
term.scopeNote = new ArrayList<>();
for (Iterator<XdmItem> lblIter = Saxon.xpathIterator(item, "skos:scopeNote",null, OpenSKOS.NAMESPACES); lblIter.hasNext();) {
term.scopeNote.add(lblIter.next().getStringValue());
}
terms.add(term);
}
} catch (SaxonApiException | MalformedURLException | URISyntaxException ex) {
Expand Down

0 comments on commit c60930e

Please sign in to comment.