Closed bgrusdt closed 8 years ago
@bgrusdt what is the template ID? do you use the dev or the production API endpoint?
Do you mean the ID of the template that is supposed to include such a variable LIMIT ? In the documentation there is a curl example which refers to a template with id=116:
curl -v -d @example.ttl -X POST -H "Content-Type: text/turtle" "http://localhost:8080/e-link/documents?templateid=116&my_limit=5"
I used the dev API endpoint.
There is no such template with ID=116, see http://api-dev.freme-project.eu/current/e-link/templates/116?outformat=json
Yes, I mentioned template 116 because it is supposed to contain the syntax for the variable LIMIT parameter in the SPARQL construct query which I am looking for. I thought the template might maybe exist somewhere I am not aware of. How do I specify the limit as variable in the sparql construct query such that I can use a limit parameter in the request ? This is mentioned here, but I am not sure how to include the @@@my_limit@@@ in the sparql construct query such that it works properly. Thanks for your help!
Here is an example of a query which takes the LIMIT as parameter:
CONSTRUCT {
?person <http://rdvocab.info/ElementsGr2/placeOfBirth> <@@@entity_uri@@@> ;
} WHERE {
?person <http://rdvocab.info/ElementsGr2/placeOfBirth> <@@@entity_uri@@@> ;
} LIMIT @@@my_limit@@@
I added a modified version of template 1 with a parameterized LIMIT (via @@@my_limit@@@). It has the id 116. But this works for some values of my_limit only, moved to this issue.
@ArneBinder can you give an example for which values it works/does not work? Thx.
@m1ci I figured out that this is not an issue of the user defined parameter. Sometimes (really randomly) I get a BadRequestExecption. I assume this is because the calculations are to slow and time out. Somehow this results in throwing this kind of exception. At the moment I do not know which is the initially thrown exception to catch it correctly.
It seems to be HttpException: 502
. I think we should return sth more meaningful than BadRequestException("It seems your SPARQL template is not correctly defined.")
.
if it is timeout then it should be 504.
@jnehring should we add the template 116 to the init-templates.sql
script? I opened #22 for the BadRequestException bug.
I tried template 116 with this data:
curl -v -d @test-for-template-1.ttl -X POST -H "Content-Type: text/turtle" "http://api.freme-project.eu/current/e-link/documents?templateid=116&my_limit=2"
and got strange behaviour for different values of my_limit:
my_limit | count(museums) |
---|---|
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 4 |
6 | 4 |
7 | 4 |
8 | 5 |
9 | 6 |
10 | 7 |
... | ... |
20 | 17 |
@m1ci can you reproduce this and do you have any explanations?
@jnehring should we add the template 116 to the init-templates.sql script?
What does template 116 do?
What does template 116 do?
It is the same as template 1 except a parametrized LIMIT. See: http://api-dev.freme-project.eu/current/e-link/templates/116
@ArneBinder
@m1ci can you reproduce this and do you have any explanations?
This seems to be caused by the timeout set by the sparql endpoint. This is a solution to the query within the constraints of a timeout. This Virtuoso feature is critical to enabling the whole world use the specific SPARQL endpint rather than specific queries monopolizing processing time.
See related discussion here https://github.com/openlink/virtuoso-opensource/issues/112
@jnehring should we add the template 116 to the init-templates.sql script?
The information is necessary in the documentation. I think it is not necessary to add this to init-templates.sql.
@m1ci thanks for your explanation! So this is not a real bug...
@jnehring
I think it is not necessary to add this to init-templates.sql.
ok
The information is necessary in the documentation.
at the moment there is a paragraph at the api-doc at POST /e-link/templates/
explaining the user defined parameter functionality. I think this is not the best place for this. Where should we put this?
EDIT: I just noticed, there is already this issue.
I would like to build an e-link/template that has a variable LIMIT such that the limit can be specified in a parameter in the request:
I wanted to check the syntax in the template with id=116 since it is referenced to in the documentation, but it does not exist. The documentation says that LIMIT @@@my_limit@@@ can be used in the sparql construct query, but this did not work for me. Somehow it must be specified that the parameter is given as request param, how is this done?
An example turtle file for the curl request above would be: