Hi Alessandro!
Thanks for your efforts in helping me :-)
I can create session now and add scopes to them, but the version where
the session ID should be created automatically does not work for me (see
below).
Am 04.07.2012 17:42, schrieb Alessandro Adamou:
On 7/4/12 4:00 PM, Melanie Reiplinger wrote:
Hello all.
I'm still on the ontonet endpoint, now trying to implement access to
the session and the library manager. I'm somehow confused about the
documentation. On
http://incubator.apache.org/stanbol/docs/trunk/ontologymanager/
<http://incubator.apache.org/stanbol/docs/trunk/ontologymanager/ontonet/>,
there are two branches:
ontologymanager/{registry|ontonet}/
and
ontonet.
I do know why this is happening, but it must be due to the way
Markdown processes the documentation sources. I removed the
trunk/ontonet path long ago, but somehow it still makes its way into
the staging build...
The correct paths are ontologymanager/{registry|ontonet}/
Both do not state examples for creating or deleting sessions. On the
RESTful docu, there is an example for a POST request that should
create a session. But that command does not work for me. Even the
curl command throws me a 'Method not allowed' when I do something like:
curl -i -X POST
"<server>/ontonet/session?scope=<scope>&session=<id>&location=<url>"
HTTP/1.1 405 Method Not Allowed
Allow: GET,OPTIONS,HEAD
Content-Type: text/html; charset=iso-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1398
Server: Jetty(6.1.x)
Was I again following the wrong documentation here?
No, this time the documentation is outdated, sorry for that.
This is because the session APIs were reworked and simplified in the
past months
To create a session:
- If you want to decide which ID to give it, just do a PUT
[stanbol-host]/ontonet/session/[ID]
- If you want Stanbol to decide the ID, do a POST
[stanbol-host]/ontonet/session
The first works fine, but for the second option, I get:
curl -i -X POST http://<stanbol>/ontonet/session
HTTP/1.1 405 Method Not Allowed
Allow: GET,OPTIONS,HEAD
Content-Type: text/html; charset=iso-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1398
Server: Jetty(6.1.x)
(I'm presently at revision 1356930)
Furthermore, at this endpoint as well as for the ontonet/ontology, PUT
and DELETE are not allowed for CORS yet, so the Http requests will fail.
When doing a preflight request for PUT to
http://<stanbol>/ontonet/session/pizzaSession
I get in the response
Access-Control-Allow-Methods:
GET, POST, OPTIONS
The latter I just reimplemented in revision 1357301 right after your
message, so if you svn update now, POST should be there again. It will
return 201 CREATED with the new session URL in the Location, or 503
FORBIDDEN if you've reached the active session quota. Right now the ID
is simply the creation timestamp.
Other than that, adding ontologies now works almost the same as in
scopes. Just do the appropriate POST with form-multipart or
form-urlencoded as for scopes. There are only these differences:
- there's no ontology addition in the PUT method at session creation
time. This is because, unlike scopes, sessions do not have a
privileged space for core ontologies.
- you can also append one entire scope (or more) to a session, so they
will be part of the overall ontology network (and the OWL artifact
that corresponds to the session will have owl:imports declarations on
the scopes), e.g.
% curl -X POST -F scope=social
[stanbol-host]/ontonet/session/melanie666
Hope this brings you a little further
Alessandro