<div dir="ltr"><div class="gmail_extra"><span style="color:rgb(56,118,29)">Hi Kaarel, </span><br><div><div><div dir="ltr"><br>---------------<br>Sincères salutations<br>Mohammed NASRI</div></div></div>
<br><div class="gmail_quote">2016-01-31 23:38 GMT+00:00 Kaarel Kaljurand <span dir="ltr"><<a href="mailto:kaljurand@gmail.com" target="_blank">kaljurand@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
you don't need to have an internet connection to use the HTTP-based<br>
service (i.e. APEWebservice). Just start the server:<br>
<br>
    ./ape.exe -httpserver<br>
<br>
and then call from your application, e.g.<br>
<br>
<a href="http://localhost:8000/?text=Every+man+is+a+human.&solo=drsxml" rel="noreferrer" target="_blank">http://localhost:8000/?text=Every+man+is+a+human.&solo=drsxml</a></blockquote><div><br><div class="gmail_default" style="font-size:small"><span style="color:rgb(56,118,29)">​Ok, I think it's a good solution. the only concern is the fact that in our platform (Amine), things must not be complicated for users, which are often not computer scientists, so they would not have to run any external program. If the APE HTTP server start/stop operations can be performed programmatically, it would be perfect, the platform runs the server before the analysis of the ACE text, and stop it once the DRS is generated. <br><br></span><span style="color:rgb(56,118,29)"><span style="color:rgb(56,118,29)">What do you think ? </span>and if the command line <b>ape.exe -httpserver</b> runs the server, how to stop it ?<br><br></span></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
and parse the result. Actually the Java Interface for APE does the<br>
parsing for you, see the Javadoc<br>
<a href="http://attempto.ifi.uzh.ch/site/docs/java/apidocs/index.html" rel="noreferrer" target="_blank">http://attempto.ifi.uzh.ch/site/docs/java/apidocs/index.html</a> and a<br>
concrete example how to use the webservice:<br>
<br>
<a href="https://github.com/Attempto/APE/blob/master/java/src/test/java/ch/uzh/ifi/attempto/ape/APEWebserviceTest.java" rel="noreferrer" target="_blank">https://github.com/Attempto/APE/blob/master/java/src/test/java/ch/uzh/ifi/attempto/ape/APEWebserviceTest.java</a><br>
<br>
i.e. you just need to start the server and have attempto-ape.jar on<br>
your classpath to be able to use it via simple Java methods.<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(0,0,0);display:inline"><span style="color:rgb(56,118,29)">​It's perfect.</span><br>​</div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I agree, getting the JPL-based access (i.e. APELocal) to work is<br>
complicated. That's one of the reasons I prefer the HTTP-interface.<br>
Your error (NoClassDefFoundError) indicates that JPL is not found on<br>
the Java class path. Have you tried the instructions on<br>
<a href="https://github.com/Attempto/APE/tree/master/java" rel="noreferrer" target="_blank">https://github.com/Attempto/APE/tree/master/java</a>? I just tried, and<br>
all the tests worked (mvn test). I had to make the following<br>
modification:<br>
<br>
<a href="https://github.com/Attempto/APE/commit/b1eab4e0640ab09fecdeb69ccccb8473dd4af947" rel="noreferrer" target="_blank">https://github.com/Attempto/APE/commit/b1eab4e0640ab09fecdeb69ccccb8473dd4af947</a><br>
<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(0,0,0)">​<span style="color:rgb(56,118,29)">I made the modifications, but I have probably a jar versionning problem, the version of my jpl is ​7 (because I have SWI-Prolog 7.3.16), which is, I suppose, not compatible with the attempto-ape.jar.​</span></div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
You probably need to do something similar. (We don't currently have a<br>
more general solution, that would work out of the box.)<br>
<br>
I'd prefer to continue this discussion on the mailing list, in this<br>
way other users can profit from it as well. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Best,<br>
Kaarel<br>
<br>
<br>
On Sun, Jan 31, 2016 at 11:33 PM, Mohammed Nasri<br>
<<a href="mailto:mohammed.nasri@gmail.com" target="_blank">mohammed.nasri@gmail.com</a>> wrote:<br>
> Hi Kaarel,<br>
><br>
> Thank you for you answers and your suggestions.<br>
><br>
> For information, here is the exact command line I generate :<br>
> /Users/mohammednasri/Travail/TLN/tln/tools/APE/ape.exe -text "John eats an<br>
> apple." -solo drsxml<br>
><br>
> When I copy/paste this line and run it in the terminal, it seems to be<br>
> correct, but with the java application, I get the following error :<br>
> ERROR: Illegal argument: arglist_namevaluelist/2: eats<br>
><br>
> Otherwise, I cannot use the APE HTTP interface if it requires an internet<br>
> connection.<br>
><br>
> I suppose, on the other hand, that the Java bridge is the best solution, if<br>
> it calls the locat APE instance. The problem with this bridge is, in my<br>
> opinion, so complicated to implement. I tried many times but in vain. Today,<br>
> I began from the begining, I installed the SWI prolog 7.3.16 (recommended<br>
> for mac os El Captain), it contains the jpl.jar library and I created a new<br>
> java application. In this application I added the attempto-ape.jar and the<br>
> jpl.jar libraries, I created a sample class with the following code :<br>
><br>
> String s = APELocal.getInstance().getSoloOutput("John eats an apple.",<br>
> OutputType.DRSXML);<br>
> System.out.println(s);<br>
><br>
> But I get this error : Exception in thread "main"<br>
> java.lang.NoClassDefFoundError: jpl/Term<br>
><br>
> I tried an other solution, by following the steps you recommend in the<br>
> <a href="https://github.com/Attempto/APE/tree/master/java" rel="noreferrer" target="_blank">https://github.com/Attempto/APE/tree/master/java</a>.<br>
> I created a new maven project, with the pom you gave in the URL. But I<br>
> always get the error that the artifact jpl:jpl:jar:6.4.1 is missing, I tried<br>
> others versions of the jar: 2.0.2 and 1.0.1 but in vain.<br>
><br>
> Now if you already have a java project with all the dependencies or a java<br>
> project that successefully run the APE local project, I would be very<br>
> thankfull if you can shared it with me.<br>
><br>
> Best regards.<br>
><br>
> ---------------<br>
> Sincères salutations<br>
> Mohammed NASRI<br>
><br>
> Hi,<br>
><br>
> it's hard to tell for sure without seeing the actual command line that<br>
> is generated by the application, but I suspect that the quotation<br>
> marks are not represented correctly and APE thinks that "eats" is not<br>
> meant to be part of the input text but some (unsupported) command.<br>
><br>
> May I suggest to call APE via its HTTP interface<br>
> (<a href="https://github.com/Attempto/APE#http-interface-to-ape" rel="noreferrer" target="_blank">https://github.com/Attempto/APE#http-interface-to-ape</a>) or the Java<br>
> bridge (<a href="https://github.com/Attempto/APE/tree/master/java" rel="noreferrer" target="_blank">https://github.com/Attempto/APE/tree/master/java</a>). It would be<br>
> _much_ faster and would also avoid errors in commandline generation.<br>
><br>
> Best,<br>
> Kaarel<br>
><br>
> On Fri, Jan 29, 2016 at 4:59 PM, Mohammed Nasri<br>
> <<a href="mailto:mohammed.nasri@gmail.com" target="_blank">mohammed.nasri@gmail.com</a>> wrote:<br>
>> Hello,<br>
>><br>
>> I developed a Java application that uses APE (Attempto Parser Engine). In<br>
>> this application, I get the ACE text from a input text field and then I<br>
>> generate the command line to be passed to APE.<br>
>><br>
>> For example, the command line I generate for the following example : "John<br>
>> eats an apple." is :<br>
>><br>
>> APE_PATH/ape.exe -text "John eats an apple." -solo drsxml<br>
>> or<br>
>> APE_PATH/ape.exe -noclex -ulexfile CUSTOM_CLEX_PATH/<a href="http://clex_lexicon.pl" rel="noreferrer" target="_blank">clex_lexicon.pl</a> -text<br>
>> "John eats an apple." -solo drsxml<br>
>><br>
>> Depending on whether we use or not a custom clex file.<br>
>><br>
>> When I run these two command lines in the terminal directly, APE works<br>
>> fine<br>
>> and prints the following same result:<br>
>><br>
>> <?xml version="1.0" encoding="UTF-8"?><br>
>><br>
>> <DRS domain="A B"><br>
>>   <object<br>
>>       ref="A"<br>
>>       noun="apple"<br>
>>       struct="countable"<br>
>>       unit="na"<br>
>>       numrel="eq"<br>
>>       num="1"<br>
>>       sentid="1"<br>
>>       tokid="4"/><br>
>>   <predicate<br>
>>       ref="B"<br>
>>       verb="eat"<br>
>>       subj="named('John')"<br>
>>       obj="A"<br>
>>       sentid="1"<br>
>>       tokid="2"/><br>
>> </DRS><br>
>><br>
>> But when I run this sentence within my application, I get this error :<br>
>><br>
>> Illegal argument: arglist_namevaluelist/2: eats<br>
>><br>
>> Do you have any idea of what can be the source of the issue ?<br>
>><br>
>> Thank you.<br>
>><br>
>><br>
>> ---------------<br>
>> Sincères salutations<br>
>> Mohammed NASRI<br>
</blockquote></div><br></div></div>