swimlane / ngx-graph

Graph visualization library for angular
https://swimlane.github.io/ngx-graph
MIT License
927 stars 285 forks source link

Allow URI style Node and Edge IDs #271

Open BenjaminHofstetter opened 4 years ago

BenjaminHofstetter commented 4 years ago

Is your feature request related to a problem? Please describe. We work a lot with linked data (semantic web). In the semantic web, we use URI which looks like http://www.w3.org/2003/01/geo/wgs84_pos#alt

When I use a URI as ID for node and edge definitions then I get the following error.

ERROR DOMException: Failed to execute 'querySelector' on 'Element': '#http://www.w3.org/2003/01/geo/wgs84_pos#alt' is not a valid selector.

Describe the solution you'd like Sanitize the ID when you use it as a 'querySelector'. I did not check the code but I think it's something like '#xxxx' on the element.

Describe alternatives you've considered Of course, I can convert the ID 'http://www.w3.org/2003/01/geo/wgs84_pos#alt' to something else. But I don't like that. I can convert the ID to http_www.w3.org_2003/01/geo/wgs84_pos_alt.

Additional context In the semantic web, the URI (id) is globally unique. These URIs are one of the key building blocks.

assafsun commented 4 years ago

I think the root cause here is the special charts that is used inside the ID which fail during node search.

In general, why the URL is inside the ID and not part of the data?

BenjaminHofstetter commented 4 years ago

In general, why the URL is inside the ID and not part of the data?

I am working with RDF and almost everything is identified by URIs. See the examples from Wikipedia.

https://en.wikipedia.org/wiki/Resource_Description_Framework#Examples