2 Answers2

1

IRI (Internationalized Resource Identifier) is an extension of the URI. It does not return data, it is an identifier. There is also no "RDF" IRI/URI; all the URIs you list are "http" or "https" URIs. Parsing such a URI would mean splitting it into parts like "http", "www.w3.org", and "/1999/02/22-rdf-syntax-ns".

Usually the web server is configured to produce semantic data (in Turtle, RDF/XML, JSON-LD, RDFa etc.; you'd use content negotiation to get one of the formats you understand) when you navigate to URIs actually denoting a vocabulary, but it doesn't have to.

There are libraries for JS for working with RDF, but if you want to do this in a web page, with client-side JavaScript, you are out of luck ‒ JavaScript doesn't allow you to retrieve the content of a cross-domain page.

IS4
  • 11,945
  • 2
  • 47
  • 86
  • Thank you very much for your reply! That's what I want to do: ```text Develop an RDF Brower(an HTML Project), use javascript to parse the "https" URIs of any address (as above), and show it in the form of list, RDF graph, etc. ``` I use `Apache Jena` to parse RDF in java projects, and I will try [rdfjs](https://github.com/rdfjs/N3.js) in this html projects. Best regards – chenkun Nov 16 '22 at 10:12
  • @chenkun So you are interested in something like [this](https://uri4uri.is4.site/uri.html/https://stackoverflow.com/questions/74440583/how-to-parse-arbitrary-rdf-iri-through-javascript/74444227), i.e. to parse a URI and represent it in RDF? – IS4 Nov 16 '22 at 15:54
  • Yes, I'm looking forward to making an html project that everyone can embed directly into any web project. – chenkun Nov 16 '22 at 17:38
0

This question has been resolved.

I use rdflib.js to parse HTTP RDF IRI:

But javascript can't parse CORS requests:

chenkun
  • 45
  • 6