linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
560 stars 142 forks source link

RDFa parser base "hack", an example and thanks! #206

Open erimille opened 6 years ago

erimille commented 6 years ago

Looking for the greenturtle rdfa parser led me here. While the rdfa parser in rdflib.js master isn't working properly, the following tweaks allowed me to get it functioning in a limited capacity. I'm hoping others might find this useful.

Comment out the following lines:

And change

After taking an initial look at the example RDFa scripts (which I'm afraid are dated and not working) and reading the code, I was able to cobble together some examples and ultimately some very useful and quick diagnostics tools for some of the work we're doing. As there seems to be only a limited number of examples, perhaps these can help others get started.

http://labs.library.link/example/map.html http://labs.library.link/example/statements.html

Details can be found viewing source, but happy to put this in a repo somewhere if folks find this useful.

The RDFa base issue looks like a sticky one and I'm afraid I can't offer anything other the above hacks, some working examples that highlight some of rdflib.js functionality, and support. But to that end, thanks to all for pulling this together. Excellent work.

csarven commented 6 years ago

Thanks for looking into this! I've also had issues with base in green turtle.

Have you tested with documents fetches through a proxy?

erimille commented 6 years ago

Very sensible question. Fetching documents through a proxy is something I've also wondered about but haven't had the time to explore. The limited time I have been able to spend has been on quickly building various prototypes. It was a bit of a learning curve, but after that, I've been very impressed with how easily its been to build a number of apps using this library and the decentralized data we're publishing.

retog commented 6 years ago

thanks @erimille for these instructions. As I didn't wanted to use a forked rdflib.js, I've extracted the relevant file, changed according to your comment and using it for RDFa parsing in browser here: https://github.com/rdf2h/browser

To see it in action with RDFa data from the web check out http://rdf2h-browser.linked.solutions/#http://schema.org/CreativeWork

erimille commented 6 years ago

Excellent! Glad that worked out for you. Here is a second confirmation it's working as you intended

I like the very simple, but linked design. I find this helpful in thinking through some of the data patterns we're publishing. Thanks!

retog commented 6 years ago

Thanks @erimille ! I'm glad you find rdf2h-browser useful. Note that the design of the resources can be fully customized by setting another renderer file in the setting, we're currently working on more specific renderers for schema.org types.