Modelling joined data in RDF/LD

Coming from a classic relational database background, I am curious about the best way to manage “joins” in linked data?

Here is an example:

  • I manage a list of locations (“Copenhagen”, “At home”, “The school”). Each of these have a name and is identified by a unique URL which points to an RDF document with the name (dc-terms title).

  • I also write notes and associate these with a location (where did I write that note).

  • I want to show a single note and display the location name.

  • I also want to show a list of my notes and their locations.

What would be the best way to show the single note and list?

My best guess is to add a statement to the note N that links it to location L: <N, has-location, L>. But that won’t show the location name in the list. So I need to lookup the location and fetch it’s name. That quickly becomes horribly in-efficient for larger lists.

So I want to fetch all notes and their location names in one go, if possible. How?

My next guess is to use SPARQL for this as I can do “joins” in that (I have some SPARQL knowledge from other projects). But that, I guess, only works for local data in the JavaScript store (using RDFLIB.js) - I can easily load all notes into the local store and query that … but how do I know which locations to insert in the store before querying with SPARQL?