Hi Melanie, sorry for the delay but I've been sick today.

On 8/22/12 12:47 PM, Melanie Reiplinger wrote:
Thank you a lot, for me this seems to work. I get e.g.

[...]
and also for the SPARQLObject it works:

{"recipe":"<http:\/\/www.dfki.de\/mere01\/recipe\/r1>","adaptedTo":"org.apache.stanbol.rules.base.api.SPARQLObject","result":"[org.apache.stanbol.rules.adapters.sparql.SPARQLQuery@1648c53]"}

but not for the other two classes, there it logs ClassNotFoundExceptions, just as for you.

I checked it back. Those two classes work for me too. I know the output for the SPARQLObject type is not very significant for the REST API, but I guess that's because adapters are mainly used for the Java API.

I'm just guessing, but probably those two types are working because the classes belong to packages exported by dependencies of the org.apache.stanbol.rules.web bundle. Whereas Rules and ConstructQuery are contributed by plugins that are not dependencies. Perhaps a solution would be to do the Class.forName() trick from within the adapter manager.

But anyway, thanks for letting me know, that already helped me. Now I just need CORS access. Do you think it makes sense for me to try that on my own by changing my version of the server according to the samples of endpoints where CORS already works? In principle, most of it seems to be about calling the addCORS and enableCORS methods in the right places, so maybe I'll try that once I'm done with the cmsadapter.

That's right. I can see the addCORSOrigin() call is there for the adapter methods though. It's not working for you? Perhaps then there should be OPTIONS preflight methods - with the enableCORSOrigin() call - for /adapters and /adapters/{recipe} ... but should they? There are only GET methods there.

If you would like to try it out and test it, please feel free to post a patch to STANBOL-712 <https://issues.apache.org/jira/browse/STANBOL-712> . Thanks a lot!

Alessandro


Am 20.08.2012 11:59, schrieb Alessandro Adamou:
Sorry, this message slipped over.

On 8/8/12 3:28 PM, Melanie Reiplinger wrote:
is there any reference for the
rules/adapters
( and rules/adapters/recipe)
?

I'm afraid I don't know much about them because they're the newest addition to the rules API as far as I know.

But from the code I see, the RESTful API should be handled like this (in GET methods)

curl [-X GET] http://[stanbol]/rules/adapters/{recipeID}?format={returnType}

The adapted recipe should be wrapped in a JSON object with the fields
- "recipe" (the original recipe)
- "adaptedTo" (the format)
- "result" (the content)

"returnType" is the canonical name of the Java class. From what I can see the supported types should be:

* com.hp.hpl.jena.reasoner.rulesys.Rule
* org.apache.clerezza.rdf.core.sparql.query.ConstructQuery
* org.apache.stanbol.rules.base.api.SPARQLObject
* org.semanticweb.owlapi.model.SWRLRule

However this isn't working for me, since every time I tried these classes, a java.lang.ClassNotFoundException was logged on a class.forName() method call.

Either the classes cannot be found because they are registered with the classloaders of other OSGi bundles, and the rules.web bundle doesn't have them in its classloader, or I am doing something wrong. Hope someone behind this feature knows better.

Sorry for not being of so much help here.

Best
-- Alessandro


Am 06.08.2012 17:33, schrieb Alessandro Adamou:
On 8/6/12 10:10 AM, Melanie Reiplinger wrote:
Do not use "application/turtle" for Turtle Syntax. Either use "text/turtle" (normative MIME type) or "application/x-turtle" (pre-registration MIME type). For the latter you should svn update and reinstall rules/web now (I also added some additional CORS support for that endpoint and fixed some wrong media type headers).

for which paths was it that you added the CORS support?

/refactor/apply and /refactor/applyfile, but neither has PUT or DELETE methods so perhaps it was not necessary.

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

Reply via email to