This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-20
Channels
- # announcements (3)
- # babashka (7)
- # beginners (43)
- # biff (19)
- # calva (39)
- # cider (16)
- # clerk (2)
- # clj-yaml (32)
- # cljs-dev (37)
- # clojure (129)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (46)
- # clojure-filipino (1)
- # clojure-gamedev (25)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (2)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (5)
- # clojure-norway (8)
- # clojure-sg (1)
- # clojure-sweden (12)
- # clojure-taiwan (1)
- # clojure-uk (9)
- # clojurescript (14)
- # core-typed (136)
- # cursive (18)
- # duct (9)
- # emacs (12)
- # etaoin (7)
- # events (1)
- # graalvm (3)
- # gratitude (2)
- # humbleui (7)
- # hyperfiddle (99)
- # introduce-yourself (5)
- # jobs (2)
- # leiningen (1)
- # missionary (14)
- # nrepl (2)
- # off-topic (12)
- # polylith (21)
- # rdf (29)
- # re-frame (8)
- # releases (1)
- # shadow-cljs (264)
- # spacemacs (21)
- # sql (7)
- # vscode (1)
TIL rdfs:member
for doing searches in e.g. Bags
SELECT ?al ?ql ?member
WHERE {
?q dns:orthogonalHypernym ?a .
?q <> "zoo"@da .
?q dns:ontologicalType ?qo .
?qo rdfs:member dnc:Animal .
?qo rdfs:member dnc:Object .
FILTER NOT EXISTS {
?qo rdfs:member dnc:Comestible .
}
?a rdfs:label ?al .
?q rdfs:label ?ql .
}
However, I wonder if there is a way to define a query where I can just exclusively return matches containing exactly [dnc:Animal dnc:Object]
?SELECT ?al ?ql ?member
WHERE {
?q dns:orthogonalHypernym ?a .
?q <> "zoo"@da .
?q dns:ontologicalType ?qo .
?qo rdfs:member dnc:Animal .
?qo rdfs:member dnc:Object .
MINUS {
?qo rdfs:member ?member . FILTER (?member != dnc:Animal && ?member != dnc:Object)
}
?a rdfs:label ?al .
?q rdfs:label ?ql .
}
i.e. Select all the ones with dnc:Animal
and dnc:Object
, and then remove any which have members that are not dnc:Animal
or dnc:Object
Incidentally, I have asked GPT-4 to answer tougher questions than this, and it’s distressingly good at writing SPARQL
I had one SPARQL query that was really tough to figure out. I was proud of it, and I was convinced ChatGPT wouldn’t get it… only for it get it on the first try.
It was also based on MINUS with embedded filters/minuses, which is why I thought of this
Right, I should probably reach for ChatGPT more often. Incidentally, these queries are actually for extracting data to test ChatGPT with 😛
It seems that graphs and LLMs are what everyone in the RDF space is interested in at the moment
Hm… it appears that the added MINUS clause makes the query take ages to finish, though… investigating
Sigh… yes, that can happen 😕 I knew this was possible, but didn’t know how big your dataset was
Can also try:
SELECT ?al ?ql ?member
WHERE {
?q dns:orthogonalHypernym ?a .
?q <> "zoo"@da .
?q dns:ontologicalType ?qo .
?qo rdfs:member dnc:Animal .
?qo rdfs:member dnc:Object .
MINUS { ?qo rdfs:member ?member . FILTER (?member NOT IN(dnc:Animal, dnc:Object)) }
?a rdfs:label ?al .
?q rdfs:label ?ql .
}
or:
SELECT ?al ?ql ?member
WHERE {
?q dns:orthogonalHypernym ?a .
?q <> "zoo"@da .
?q dns:ontologicalType ?qo .
?qo rdfs:member dnc:Animal .
?qo rdfs:member dnc:Object .
FILTER (NOT EXISTS { ?qo rdfs:member ?member . FILTER (?member NOT IN(dnc:Animal, dnc:Object)) })
?a rdfs:label ?al .
?q rdfs:label ?ql .
}
But they’ll probably perform similarly. It totally depends on implementationWent with this
SELECT ?al ?ql
WHERE {
?q dns:orthogonalHypernym ?a .
?q dns:ontologicalType ?qo .
?qo rdfs:member dnc:Animal .
?qo rdfs:member dnc:Object .
FILTER NOT EXISTS {
?qo rdfs:member ?member .
FILTER (?member NOT IN(dnc:Animal, dnc:Object))
}
?a rdfs:label ?al .
?q rdfs:label ?ql .
}
What’s the vocabulary for dns / dnc in your examples? Your own ontology? Looks interesting :)
the schemas in question: https://wordnet.dk/schema/dns and https://wordnet.dk/schema/dnc In use: https://wordnet.dk/dannet/data/synset-31493