Hi Alessandro.

Thank you a lot, for me this seems to work. I get e.g.

curl -i -X GET http://[stanbol]/rules/adapters/http://www.dfki.de/mere01/recipe/r1?format=org.semanticweb.owlapi.model.SWRLRule
HTTP/1.1 200 OK
Content-Type: application/rdf+json
Transfer-Encoding: chunked
Server: Jetty(6.1.x)

{"recipe":"<http:\/\/www.dfki.de\/mere01\/recipe\/r1>",
"adaptedTo":"org.semanticweb.owlapi.model.SWRLRule",
"result":"[DLSafeRule(
    Body(
ObjectPropertyAtom(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/r>
Variable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/x>)
Variable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/z>)
        )
ObjectPropertyAtom(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/r>
Variable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/z>)
Variable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/y>)
        )
    )
    Head(
ObjectPropertyAtom(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/r>
Variable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/x>)
ariable(<http:\/\/incubator.apache.org\/stanbol\/rules\/variables\/y>)
        )
    )
)]"}


and also for the SPARQLObject it works:

curl -i -X GET http://lnv-89012.dfki.uni-sb.de:9001/rules/adapters/http://www.dfki.de/mere01/recipe/r1?format=org.apache.stanbol.rules.base.api.SPARQLObject
HTTP/1.1 200 OK
Content-Type: application/rdf+json
Transfer-Encoding: chunked
Server: Jetty(6.1.x)

{"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. 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.

Best,
Melanie


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







Reply via email to