asami 2024-08-12

So... what is happening in the (open) world of Asami? ๐Ÿ™‚ Just generally curious, no specific thoughts.

Itโ€™s a bit slow right now. Iโ€™m doing things for it, but focusing on other things just recently. However, most of those things are supposed to integrate one day ๐Ÿ˜Š

โ˜€๏ธ 1

All is well then ๐Ÿ˜„ โœŒ๏ธ

I wrote libraries for RDF, which Iโ€™ve been integrating. Right now Iโ€™m writing a SPARQL parser. But I need to update the query engine to support multiple graphs before I can fully integrate that. So itโ€™s slow going (especially when you consider that I am currently writing something that is about ML and not graphs)

What is the ELI5 reason you need to support multiple graphs? Is it somehow builtin to the SPARQL specs to handle more than one at the same time?

Fantastic, thank you for the thorough explanation. I need to dive into all of this more ๐Ÿ˜„

I don't know all the specifics, but see https://en.wikipedia.org/wiki/Named_graph

While itโ€™s certainly possible to implement SPARQL without multiple graph support, this would be a subset of the spec.

SPARQL defines a "default graph". This actually has 2 meanings, though I doubt many people would agree to that (argh!)

๐Ÿ˜„ 1

Anyway, when you're querying with SPARQL, each part of your query will be getting data from the "default graph", unless you explicitly state otherwise.

The "default graph" is defined in your query as either: โ€ข a system default โ€ข the union of all the graphs that you've listed as FROM clauses

So, if you don't say anything, your get the system default. But if you say: FROM medical:snomed then your query will default to using medical:snomed. If you say:

FROM medical:snomed
FROM medical:icd10
Then your query will default to using the union of these 2 graphs

But then you can ALSO add in "named graphs"

If you've named a graph, then you can select from it explicitly:

SELECT ?name ?generalName
FROM medical:snomed
FROM NAMED medical:icd10
{ GRAPH medical:icd10 { ?disease skos:notation "C43.9" ;
                                 rdfs:label ?name }
  ?snomedDisease rdfs:name ?name ;
                 rdfs:subClassOf ?parent .
  ?parent rdfs:label ?generalName }
So here, I've selected parts from the ICD10 graph by name. ICD10 appeared in the FROM NAMED section, and so I can use it as a name in the GRAPH part of a pattern (the notation and a label). The rest of the query has no GRAPH modifiers, so that comes from the default graph. That's just the SNOMED graph here.

The examples here are contrived, but they show a common approach: different datasets in different graphs. You can then select from each dataset as appropriate. This is particularly important for datasets that share some entities, but have different descriptions for them (such as different rdfs:label values)

I do this sort of thing all the time using Stardog, GraphDB, or Jena. I would like to do it with Asami