asami

2024-08-12T08:17:47.727099Z

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

quoll 2024-08-12T10:55:11.578639Z

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
2024-08-12T11:06:29.382609Z

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

quoll 2024-08-12T11:28:18.426789Z

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)

2024-08-12T12:53:45.937819Z

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?

2024-08-13T07:24:32.045889Z

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

refset 2024-08-12T13:47:31.540499Z

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

quoll 2024-08-12T14:27:46.592719Z

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

quoll 2024-08-12T14:28:21.908789Z

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

๐Ÿ˜„ 1
quoll 2024-08-12T14:29:09.402869Z

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.

quoll 2024-08-12T14:29:49.695729Z

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

quoll 2024-08-12T14:31:55.675899Z

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

quoll 2024-08-12T14:32:22.965989Z

But then you can ALSO add in "named graphs"

quoll 2024-08-12T14:40:35.894729Z

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.

quoll 2024-08-12T14:42:24.702829Z

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)

quoll 2024-08-12T14:43:10.820619Z

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