-
Notifications
You must be signed in to change notification settings - Fork 5
basic interaction
carueda edited this page Dec 30, 2014
·
15 revisions
$ mkdir ~/orr-ont-base-directory/mongo-dbpath
$ mongod --dbpath ~/orr-ont-base-directory/mongo-dbpath
$ cd orr-ont
$ ./sbt test
$ cd orr-ont
$ ./sbt 'container:start'
Using httpie
$ http post localhost:8080/user userName=calvin firstName=Cal lastName=Vin password=hobbes
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
Transfer-Encoding: chunked
{
"registered": "2014-12-30T01:36:44Z",
"userName": "calvin"
}
$ http get localhost:8080/user
HTTP/1.1 200 OK
Content-Length: 59
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
[
{
"registered": "2014-12-30T01:36:44Z",
"userName": "calvin"
}
]
$ http post localhost:8080/user/chkpw userName=calvin password=hobbes
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
Transfer-Encoding: chunked
{
"userName": "calvin"
}
$ http post localhost:8080/org orgName=mmi name="mmi project" members:='["calvin"]'
HTTP/1.1 401 Unauthorized
Content-Length: 15
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
WWW-Authenticate: Basic realm="orr-ont realm"
Unauthenticated
$ http -a calvin:hobbes post localhost:8080/org orgName=mmi name="mmi project" members:='["calvin"]'
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
REMOTE_USER: calvin
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=j7caoidfw7p41nu7m121hrlmj;Path=/
Transfer-Encoding: chunked
{
"orgName": "mmi",
"registered": "2014-12-30T01:48:59Z"
}
$ http get localhost:8080/org
HTTP/1.1 200 OK
Content-Length: 76
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
[
{
"name": "mmi project",
"orgName": "mmi",
"registered": "2014-12-30T01:48:59Z"
}
]
$ http get localhost:8080/org/mmi
HTTP/1.1 200 OK
Content-Length: 74
Content-Type: application/json;charset=UTF-8
Server: Jetty(8.1.8.v20121106)
{
"name": "mmi project",
"orgName": "mmi",
"registered": "2014-12-30T01:48:59Z"
}
$ http -f post localhost:8080/ont uri=http://ont1 name=example orgName=mmi userName=calvin file@src/test/resources/test.rdf format=rdf
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=q6qy3sixki24qflehoco6qmi;Path=/
Transfer-Encoding: chunked
{
"registered": "2014-12-30T01:52:22Z",
"uri": "http://ont1",
"version": "20141229T175222"
}
$ http -f post localhost:8080/ont/version uri=http://ont1 userName=calvin file@src/test/resources/test.rdf format=rdf
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=1wq8817zwbymb2lz3rtyz32ua;Path=/
Transfer-Encoding: chunked
{
"updated": "2014-12-30T01:54:45Z",
"uri": "http://ont1",
"version": "20141229T175445"
}
$ http get localhost:8080/ont
HTTP/1.1 200 OK
Content-Length: 116
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=19emqgufcdmqq51aazhcnb2sv;Path=/
[
{
"name": "",
"uri": "http://ont1",
"versions": [
"20141229T175222",
"20141229T175445"
]
}
]
$ http get localhost:8080/ont\?uri=http://ont1\&format=n3
HTTP/1.1 200 OK
Content-Length: 268
Content-Type: text/n3;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=a4z6g92prvbvkmz7uvn4zz0l;Path=/
@base <http://ont1> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix myont: <http://localhost:8080/ont/myorg/myont/> .
<myont:hobbes> a <Character> .
<myont:calvin> a <Character> ;
myont:hasFriend <myont:hobbes> .
$ http -f post localhost:8080/ont uri=http://localhost:8080/ont/mmi/selfhosted name="self-hosted entry" orgName=mmi userName=calvin file@src/test/resources/test.rdf format=rdf
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=163fxgr4lrk572xkcpj8mbcmx;Path=/
Transfer-Encoding: chunked
{
"registered": "2014-12-30T02:10:02Z",
"uri": "http://localhost:8080/ont/mmi/selfhosted",
"version": "20141229T181002"
}
$ http get http://localhost:8080/ont/mmi/selfhosted
HTTP/1.1 200 OK
Content-Length: 310
Content-Type: application/rdf+xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=1q99q7ra3iopnkdutd8woockh;Path=/
<?xml version="1.0" ?>
<rdf:RDF xmlns:myont="http://localhost:8080/ont/myorg/myont/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Character rdf:about="myont:calvin">
<myont:hasFriend rdf:resource="myont:hobbes"/>
</Character>
<Character rdf:about="myont:hobbes">
</Character>
</rdf:RDF>
#### Get self-hosted ontology in a particular format:
$ http get http://localhost:8080/ont/mmi/selfhosted\?format\=n3
HTTP/1.1 200 OK
Content-Length: 297
Content-Type: text/n3;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=172usf1ouibw31mttfjl785xz1;Path=/
@base <http://localhost:8080/ont/mmi/selfhosted> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix myont: <http://localhost:8080/ont/myorg/myont/> .
<myont:hobbes> a <Character> .
<myont:calvin> a <Character> ;
myont:hasFriend <myont:hobbes> .
$ http -f put localhost:8080/ont/version uri=http://localhost:8080/ont/mmi/selfhosted version=20141229T181002 userName=calvin name="self-hosted entry (renamed)"
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=b92jjqwg9gu6g9hwh0oy6c3l;Path=/
Transfer-Encoding: chunked
{
"updated": "2014-12-30T02:10:02Z",
"uri": "http://localhost:8080/ont/mmi/selfhosted",
"version": "20141229T181002"
}
$ http delete localhost:8080/ont\?uri=http://localhost:8080/ont/selfhosted\&userName=calvin
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=1jzzp8f6f0sv7w8h0z7pawudd;Path=/
Transfer-Encoding: chunked
{
"removed": "2014-12-30T02:36:24Z",
"uri": "http://localhost:8080/ont/selfhosted"
}
http delete localhost:8080/ont/version\?uri=http://ont1\&version=20141229T175445\&userName=calvin
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=9mdqu3j5qraz158paz6mnd629;Path=/
Transfer-Encoding: chunked
{
"removed": "2014-12-30T02:39:11Z",
"uri": "http://ont1",
"version": "20141229T175445"
}
$ http get localhost:8080/ont
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(8.1.8.v20121106)
Set-Cookie: JSESSIONID=1axq2kdvs3wle1wukxxffrf1pl;Path=/
[
{
"name": "example",
"uri": "http://ont1",
"versions": [
"20141229T175222"
]
},
{
"name": "self-hosted entry (renamed)",
"uri": "http://localhost:8080/ont/mmi/selfhosted",
"versions": [
"20141229T181002"
]
}
]