Hi Melanie,
I'm groping my way a bit on this endpoint because I'm not as savvy on
the rule manager as on the ontology manager, but I've seen the code
quite a few times.
1) (just a minor issue)
The RESTful docu is a bit confusing here, since it states as endpoints
<stanbol>/rule
<stanbol>/recipe
<stanbol>/refactor
<stanbol>/refactor/apply
In the apache docu it's
<stanbol>/rules/store
<stanbol>/rules/recipe
<stanbol>/rules/refactor
<stanbol>/rules/refactor/apply
Looks like they're both outdated, but the Apache site seems more
up-to-date. I can see these endpoints:
/rules/recipe # for storing and organizing rules
/rules/recipe/[ID] # see below
/rules/find/recipes # search by description using SPARQL string matching
/rules/find/rules
/rules/adapters/ # for exporting in other formats such as SWRL and
SPARQL Construct
/rules/adapters/recipe
/refactor # uses a stored recipe. we should move this to /rules/refactor
/refactor/apply # uses a recipe supplied in the request payload
/refactor/applyfile # this is redundant, it's like calling
/refactor/apply on @filename
Theoretically the recipe identifier [ID] can be almost any string.
However, last time I tried refactoring it only worked if ID was an IRI,
such as
[stanbol-host]/rules/recipe/http://dfki.de/rules/recipe/1
Please bear with this, I'm sure it will be fixed if it hasn't been already.
2)
Also, in the RESTful docu all examples name "http://localhost:8080" as
<stanbol>. I guess this means that I have to set my stanbol home
somewhere in the configuration ? ( I haven't found the right place as
yet ).
You don't have to, not this time. It's just that the REST API
documentation uses hardcoded URLs rather that dynamically with
freemarker. Feel free to use your hostname instead.
3)
To find something to start with, I tried to create a recipe, which is
"a container *[...]***, which identifies a set of rules that share the
same business logic and interpret them as a whole." [1]
So, when stating
curl -i -X POST -d recipe="r1" -d description="A test recipe."
http://<stanbol>/rules/recipe
I get as response:
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: 1395
Server: Jetty(6.1.x)
Am I doing it the wrong way, or do I need the methods POST (and
DELETE) to be allowed from server-side ?
you have to PUT /rules/recipe/r1 and then POST the rules onto that resource.
but as I said, there might be problems if you try to refactor an
ontology afterwards. If so, maybe for the time being you're better off using
/rules/recipe/http://www.dfki.de/melanie/recipe/r1
or something like that.
And don't forget that resource expects multipart formdata in the POST
HTH
Alessandro
--
M.Sc. Alessandro Adamou
Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy
Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy
"I will give you everything, just don't demand anything."
(Ettore Petrolini, 1917)
Not sent from my iSnobTechDevice