-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test RDF in a data island in the HTML #1714
Comments
@bourgeoa thanks for looking at this A structured data island is simply: <script type="application/ld+json" id="data">
{
"json-ld": "goes here"
}
</script> Then the content of the script would be whatever the JSON-LD is for that resource So in the case where we have mashlib in a script an extra script tag is inserted with the data too This would make all of the different mime types give back consistent RDF Does that make sense? |
It's probably worth noting that such data islands may be in additional formats (media types), either in parallel with or instead of JSON-LD. At OpenLink Software, we commonly inject data islands in both JSON-LD and Turtle. Other media types have also been used in experiments but are not commonly parsed, so are not commonly injected. |
@TallTed, do you have an example we could use as a template for learning, |
This article should be a help. |
So my understanding is the following :
|
The PR #1715 implements the following :
Data island is fetched with :
Question : |
This is fantastic! Could the default be application/ld+json or configurable, say, in the NSS config? Reason being that parsing JSON is native to the browser and easy Unsure about the PATCH operation, isnt that server wide? |
I tried running the dataIsland branch locally and managed to log in. But I was unable to see a data island in the webid profile that was created. Will have a look to see if there's anything obvious that can be fixed |
Well webid is not an html resource. |
@bourgeoa ah, i see, thank you re: patch, yes turtle I think is best default in that case Would it be possible to generate data islands on the server side? I'm not sure if there are many benefits to making changes on the client side |
I'm not sure to understand what you are looking at. Data island is just a way to store RDF data in an html document. Dokieli is an other way. |
No, just the same way it's done today When we get an HTML file it contains mashlib, and that file is given to the browser by node solid server What I'm saying is that, as well as adding mashlib, give back a data island in the RDF so that it's consistent with the other mime types The way to test this, would be to run curl against the file, and see if the data island is there. This is something I'm trying to write a test for the test suite, to explain it better So NSS when it has a GET request, and gives back HTML, also pulls in the JSON-LD and puts it in a script tag |
Where is the JSON-LD located ? can you give an html content with JSONLD content ? |
Yes you put the RDF in a SCRIPT tag inside the HTML This is how most of the semantic web works today, outside of Solid. Having RDF in HTML would bring solid up to par with the majority of existing semantic web Example Alice has a curl Gives back:
The RDF for the webID is stored on the server, but returned by node solid server So exactly as we have today, but now HTML files also have RDF, just like the other mime types
Yes, this would be an excellent tool for testing |
Side thought: It might be possible that the JSON-LD returned from NSS and the html returned form NSS could be almost identical JSON-LD returned by NSS{
JSON-LD-HERE
} HTML returned by NSS<html>
...
...
<script> {
JSON-LD-HERE
} </script>
... mashlib here
<body> here
</html> This might be relatively easy to code if the same view is copied from JSON-LD to HTML, and some scaffolding added. If I get some cycles free, I might give this a try in a local branch |
I think I have isolated the code that does this: https://github.com/nodeSolidServer/node-solid-server/blob/main/lib/handlers/get.js#L84 I might be able to change the resource mapper a bit so that it brings back JSON-LD then put that into the HTML with the databrowser config setting |
Mashlib is an app running in the browser that allow to browse pod/pods documents giving different representation depending on RDF data, content negotiation or actions ( create/edit ...) An html document My PR add only content negotiation.
This line just tells if that URL can be displayed using mashlib app. A pod URL pointing to an html document is not displayed with mashlib but directly by the browser and contains all the html including the data island if any. |
@bourgeoa the content type The way to fix this is to put the JSON-LD inside a script tag in the HTML as shown above Doing it client side, does not fix the issue, it can be tested here I believe it can be fixed here: https://github.com/nodeSolidServer/node-solid-server/blob/main/lib/handlers/get.js#L84 By changing the content pulled in by the resource mapper. If I get time I'll have a go locally and a proof of concept |
@melvincarvalho As you can see the data island is there for this URL https://bourgeoa.solidcommunity.net/public/alain.html Exactly what mashlib give in the source-pane |
@bourgeoa that looks beautiful! I can confirm it works with curl: <html>
<script type="text/turtle" id="data">
<> a "test".
</script>
<body>test data island</body> Fantastic! A few things:
In short, everything should be exactly how is was before. With html / head / body / mashlib. The only difference is one extra script tag containing RDF. So the change to the page should be quite minor. |
Another point, while RDF is being returned in this one file, RDF needs to be returned by NSS for every file Example Resource
HTTP GET with Curl
What is returned (no RDF)<html><head><meta charset="utf-8"/><title>SolidOS Web App</title><script>document.addEventListener('DOMContentLoaded', function() {
panes.runDataBrowser()
})</script><script defer="defer" src="/mashlib.min.js"></script><link href="/mash.css" rel="stylesheet"></head><body id="PageBody"><header id="PageHeader"></header><div class="TabulatorOutline" id="DummyUUID" role="main"><table id="outline"></table><div id="GlobalDashboard"></div></div><footer id="PageFooter"></footer></body></html> What SHOULD be returned (includes RDF)<html><head><meta charset="utf-8"/><title>SolidOS Web App</title>
<!--- DATA ISLAND SHOULD GO IN HERE -->
<script>document.addEventListener('DOMContentLoaded', function() {
panes.runDataBrowser()
})</script><script defer="defer" src="/mashlib.min.js"></script><link href="/mash.css" rel="stylesheet"></head><body id="PageBody"><header id="PageHeader"></header><div class="TabulatorOutline" id="DummyUUID" role="main"><table id="outline"></table><div id="GlobalDashboard"></div></div><footer id="PageFooter"></footer></body></html> |
It is a bad html. But it is example. I mistyped the closing html tag But https://bourgeoa.solidcommunity.net/public/ which is a container URL does use mashlib app. (Container have a turtle representation. |
Mashlib is needed. It it there today. It should not be removed. Nothing should be removed, only a script tag added, which contains RDF A good example to test would be: https://bourgeoa.solidcommunity.net/public/approxlocation.ttl |
@timbl do you agree with that ? This seems a very interesting point. |
@melvincarvalho
How can I help you ?
container/
with index.html automatically serves index.htmlAn Html file with a dataIsland example may help me to understand.
The text was updated successfully, but these errors were encountered: