Comments (9)
Hi Christian, tricky indeed.
I copied the JSON content (from the log) to a separate file, and manually ran a script that uses the ML/JsonLD library (that is being used by the SPARQL micro-services). That worked fine, the JSON was converted to JSON-LD. So the JSON returned by the API is ok.
My guess is about an encoding issue in the response from the API. For instance it may not be UTF-8.
Could you please rerun the curl command to the API, but with the --verbose option, to see all the HTTP headers together with the content?
Franck.
from sparql-micro-service.
Hi Frank,
First of all thanks for taking care of my problem. The problem seems not to be related to string encoding. Doing the curl with a --verbose did not result in some strange characters in my result and not in any errors. So I added some print statements to the Processor.php and found that the string that should be parsed is not my service response but some different string that looks like the contents of my profile.jsonld.
I the function parse in Processor.php where the exception is thrown I added a print statement.
/**
* Parses a JSON-LD document to a PHP value
* @param string $document A JSON-LD document.
* @return mixed A PHP value.
* @throws JsonLdException If the JSON-LD document is not valid.
*/
public static function parse($document)
{
print("Following document was returned\n");
print($document);
.....
This gives me the following output:
---------------8<---------------
Following document was returned
{
"@context": {
"@base": "http://ns.inria.fr/sparql-micro-service/item/",
"@vocab": "http://ns.inria.fr/sparql-micro-service/api#",
}
}
So it seems as if I try to parse the content of my profile.jsonld file and not the response returned by the server.
Any ideas?
best, Christian
from sparql-micro-service.
Yes weird indeed.
Just a check: you mentioned earlier that you created files config.ini, profile.jsonld and service.php.
Why do you need the service.php file? This is normally used only when specific action must be taken. But in the most common case, you should not need it. A config.ini + profile.jsonld is sufficient to get the SPARQL micro-service to work.
Later, if you need specific mapping, you may also create the optional construct.sparql file.
I'm concerned that your service.php would do a wrong manipulation and return the profile instead of the API repsonse.
Franck.
from sparql-micro-service.
Hi Frank
I removed the service.php from all my services and the problem remains. I have attached a service configuration (service.zip) and my config.ini and service.php from the src/sparqlms directory.
best, Christian
assets.zip
config.ini.txt
service.php.txt
from sparql-micro-service.
The function Processor::parse() where you added a print is called when loading the profile.jsonld, so the trace you get is normal.
But that also means that the failure occurs as soon as the profile is loaded, before we even try to process the API response.
In the profile.jsonld, I can see an extra comma at the end of the line
"@vocab": "http://ns.inria.fr/sparql-micro-service/api#",
Can you remove it and retry?
Franck.
from sparql-micro-service.
Hi frank,
finally removiing the comma in the jsonld file did the trick. Now I get the desired results. In fact I never looked at this file carefully since it was copied from the manual_config_example folder. So it might be good to correct this in the next relase.
thank you for taking care,
Christian
from sparql-micro-service.
Thx @kleegrewec,
Indeed I've seen this mistake manual_config_example, sorry about that, I'll commit this fix soon.
I've double-checked with other services where I did not see the error.
It is also a pb that the error message says "could not load the Web API response", whereas the error was in the profile. But this is coded in the JsonLD package that I used.
Anyway, I would appreciate if you can let me know (by personal email if you prefer) what you use SPARQL microservices for, just for information.
Regards,
Franck.
from sparql-micro-service.
from sparql-micro-service.
Ok cool, thx for the information.
from sparql-micro-service.
Related Issues (20)
- Problem running docker images HOT 1
- Federated recursive query HOT 13
- Improve documentation HOT 2
- Support for multiple values of a custom parameter on the http query string HOT 1
- Allow different strategies for passing multiple values to the Web API HOT 1
- No triples are generated if file construct.sparql is not present HOT 1
- Support Web API with no parameter HOT 1
- Problem testing docker deployment HOT 25
- discussion: a similar project HOT 1
- How to test queries from remote HOT 7
- Implement http_header config param in the Service Description mode HOT 1
- Microservices do not accept content type "application/x-www-form-urlencoded;charset=utf-8" HOT 5
- Document rewriting rules for HTML doc generation HOT 1
- Support for multiple values of an argument in ServiceDescription mode HOT 1
- cache_expires_after doesn't work HOT 1
- Nested calls to micro-services don't work HOT 2
- Implement paging of results from Web API
- Generate provenance information HOT 1
- SPARQL Microservice behind proxy HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparql-micro-service.