Skip to content

Commit 6943543

Browse files
committed
Document API usage
Closes #7
1 parent 409c5e2 commit 6943543

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

Readme.md

+45
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,57 @@ This is a discriminative triple: French applies to Paris because Paris is a Fren
1414

1515
## How can I use it?
1616
The best way to use Hawk is through the API.
17+
18+
### Running a Local Server Instance
19+
1720
We don't have a public endpoint (yet), so you'll have to run a local instance though. So:
1821
1. Download the .tar.gz
1922
2. `tar -xf` it^
2023
3. `java --jar theFile.jar locationToIndexesDirectory`
2124
4. Now you should be able to access the API on `localhost:8080/`, nois!
2225

26+
### API Usage
27+
28+
Graphical front end can be accessed by pointing your browser to the address _without_ `/api`.
29+
E.g. to access properties front end after running the server on your machine point your browser to `localhost:8080/properties` and for a programmatic API send requests to `localhost:8080/properties/api`.
30+
31+
#### Obtaining Properties
32+
33+
Returns a list of properties with their roles in parenthesis, organized by source.
34+
For example (shortened):
35+
36+
```
37+
{"WKP_Graph":["Hawk(definiendum)", "an(O)","unincorporated(B-differentia-quality)","community(B-supertype)","in(B-differentia-quality)"]
38+
"WKT": ["hawk(definiendum)","diurnal(has_diff_qual)","of the family Accipitridae(has_origin_loc)","predatory_bird(has_supertype)"]}
39+
```
40+
41+
Accessible on `HOST_NAME/properties/api` and requires 3 parameters:
42+
43+
1. `properties`, which properties do you want?
44+
Accepted values:
45+
`p` for `pivot`'s properties
46+
`c` for `comparison`'s properties
47+
`p-c` `pivot`'s minus `comparison`'s
48+
`c-p` `comparison`'s minus `pivot`'s
49+
`intersection` the common properties of `pivot` and `comparison`.
50+
51+
2. `pivot` string value of pivot
52+
53+
3. `comparison` string value of comparison
54+
55+
#### Determining Discriminativity
56+
57+
Returns two element lists, organized by source `[DECISION, JUSTIFICATION]`, where `DECISION` is `"true"`/`"false"` and `JUSTIFICATION` is a natural language justification for the decision.
58+
For example:
59+
60+
```
61+
{"WKP_Graph":["false","Because hawk and eagle don't contain bird as a property"],"WKT":["false","Because hawk and eagle don't contain bird as a property"],"WN":["true","Because hawk contains bird in property of has_supertype and has_supertype role and eagle doesn't contain bird as one of its properties."]}
62+
```
63+
64+
Accessible on `HOST_NAME/roleBasedVote/api` requires 3 parameters:
65+
`pivot`, `comparison`, `feature`
66+
and returns whether `pivot` and `feature` have a common property, that `comparison` doesn't have (the role of the property as well as the value is taken into account under this comparison type).
67+
2368
## How can I contribute?
2469
First of all thanks for showing interest in Hawk!
2570
These are the recommended steps for contributing:

0 commit comments

Comments
 (0)