Skip to content
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

Inverse relations page #53

Open
simongray opened this issue Oct 12, 2022 · 3 comments
Open

Inverse relations page #53

simongray opened this issue Oct 12, 2022 · 3 comments

Comments

@simongray
Copy link
Member

It would be beneficial to have an endpoint listing reverse relations for some key-value pair, e.g.

[:dns/ontologicalType #{:dnc/BoundedEvent
                        :dnc/Cause}]

... is a key-value pair of :dn/synset-44357 (samle).

It would be interesting to have a link to a reverse relations page available for each value column, with perhaps some exceptions.

@simongray simongray changed the title Reverse relations page Inverse relations page Jun 20, 2023
@simongray
Copy link
Member Author

simongray commented Jun 21, 2023

Ok, so I have a proof-of-concept going now which simply reuses the current entity page to present either [?p ?s] triples (inverse relations for ?o) or [?s ?o] triples (connections via ?p), but it suffers from some issues:

  • As the entity page is reused, the layout doesn't fit or isn't clearly different from the regular entity page.
    • In the case of inverse relations, perhaps this can be remedied by some explanatory text as well as some symbols to indicate the different relationship being depicted.
      • The symbols could be a one-to-many arrow on either side of the normal entity and inverse entity pages, and two one-to-many arrows on the connections page (one on each side).
    • In the case of connections, it might make sense to make the columns equal width.
  • The inverse connections page will have similar performance to the entity page, all other things equal, but the connections page will often have thousands of data points to download and render. I need to look into a solution for partial rendering of this data, e.g. adding limit and offset somehow.

@simongray
Copy link
Member Author

simongray commented Jun 23, 2023

https://stackoverflow.com/questions/18212697/aggregating-results-from-sparql-query

A combination of GROUP BY and GROUP_CONCATcan be used to group directly in SPARQL. However,

  • there is no way to limit the amount of items in the aggregated column using LIMIT (that only applies to the grouped-by column)
  • the aggregated data itself is just a string in Aristotle that will need to be turn into an actual set of Clojure data.
  • the aggregated data loses information since it's just an aggregation of the string data, e.g. the URL itself e.g. http://example.com/resource in the case of <http://example.com/resource>.
    • Perhaps I should only select RDF resources? It would make conversion in ?items groups easier

@simongray
Copy link
Member Author

I asked the following on the #RDF channel on Clojurians Slack:

anybody here have any experience using GROUP BY and GROUP_CONCAT(...) in SPARQL? My use case is returning limited results in alphanumeric order, but each row is a potential one-to-many relationship. Is it possibly more performant to skip grouping and just use ORDER BY along with a bunch of additional queries?

Unfortunately, it seems like GROUP_CONCAT basically just turns groups items into a concatenated string and even removes important information such as the enclosing <...> , which makes it a bit of a hack IMO.

Perhaps I need to stash the changes for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant