Closed Sophietje closed 10 months ago
In GitLab by @han.kruiger.tno.nl on May 11, 2023, 11:00
Hi @jarne.kerkaert.inetum-realdolmen.world
This error occurs because the body contains this binding:
{
"a": "\"1.2\"^^http://www.w3.org/2001/XMLSchema#float",
"b": "\"1.2\"^^http://www.w3.org/2001/XMLSchema#float"
}
But it is missing the fish brackets:
{
"a": "\"1.2\"^^<http://www.w3.org/2001/XMLSchema#float>",
"b": "\"1.2\"^^<http://www.w3.org/2001/XMLSchema#float>"
}
That should fix it. Can you let me know if that works?
In GitLab by @jarne.kerkaert.inetum-realdolmen.world on May 11, 2023, 11:05
Hi Han,
Thank you very much! This does indeed work, but it doesn't explain why sending POST requests works without the brackets. It's quite difficult to change our code in this way.
It seems like react interactions are handled in a different way than post interactions
In GitLab by @han.kruiger.tno.nl on May 11, 2023, 12:22
Great!
Yes, the way that the Knowledge Engine REST server handles the proactive (ASK/POST) interactions differs from the way that it handles the reactive (ANSWER/REACT) interactions.
I can see that it would be pretty useful to have the binding validation working for the proactive interactions as well. (And honestly I thought that it already did that, but it appears not!)
Made an issue for it: #415
In GitLab by @barry.nouwt.tno.nl on May 11, 2023, 13:47
@jarne.kerkaert.inetum-realdolmen.world Good to hear it works now! Just wondering; why is it difficult to change your code in that way? Always using angle brackets (<
and >
) should always work if I am correct.
In GitLab by @jarne.kerkaert.inetum-realdolmen.world on May 12, 2023, 06:01
@barry.nouwt.tno.nl The reason I mentioned that is because we use a RDF library (Jena RDF API) internally, and the way we produce a literal to send to KE is like this:
ResourceFactory.createTypedLiteral(load).toString()
which returns "1.2"^^http://www.w3.org/2001/XMLSchema#float
.
Up until now this has always worked as we haven't used the return function of REACT interactions anywhere. So updating this might take some searching. We can just hardcode the correct values though for now.
Seeing as using <
>
is actually supposed to be the correct way in all cases, I am fully in favour of updating our implementation :)
In GitLab by @barry.nouwt.tno.nl on May 12, 2023, 06:46
@jarne.kerkaert.inetum-realdolmen.world Try to use Apache Jena's FmtUtils
(see code below) to generate correct nodes, since the Node#toString()
method of Apache Jena is meant to be human-readable (see javadoc).
String s = "\"1.2\"^^<http://www.w3.org/2001/XMLSchema#float>";
Node n = SSE.parseNode(s);
String s2 = FmtUtils.stringForNode(n, new PrefixMappingMem());
System.out.println("String: " + s2);
The empty new PrefixMappingMem()
is used to force it to not use prefixes.
Hope this helps!
In GitLab by @barry.nouwt.tno.nl on Jun 9, 2023, 12:26
Closing this issue, because it seems solved. If it is not, please reopen it and provide further details.
In GitLab by @barry.nouwt.tno.nl on Jun 9, 2023, 12:26
changed the incident status to Resolved by closing the incident
In GitLab by @jarne.kerkaert.inetum-realdolmen.world on May 11, 2023, 10:54
We are receiving an error when sending literals in a bindingset in REACT interactions. This is VERY blocking for us.
Create sender kb
Create partner kb
Register post to sender kb
Register react to partner kb
Start polling on parter kb
Send post with sender kb
Receive post with partner kb
React with partner kb
Partner kb receives error from kb
Notes
KE version 1.1.3
Sending POST interactions works
Same issue appears with different kinds of literals
We don't use generic adapter, we talk directly to KE