This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-29
Channels
- # admin-announcements (1)
- # announcements (20)
- # babashka (43)
- # beginners (134)
- # calva (2)
- # clerk (7)
- # cljdoc (9)
- # clojars (8)
- # clojure (91)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (13)
- # clojure-uk (1)
- # clojurescript (5)
- # datahike (3)
- # docker (2)
- # emacs (6)
- # fulcro (7)
- # graphql (9)
- # honeysql (24)
- # improve-getting-started (5)
- # introduce-yourself (1)
- # lambdaisland (1)
- # luminus (3)
- # malli (3)
- # nbb (19)
- # off-topic (22)
- # pathom (1)
- # portal (3)
- # practicalli (1)
- # rdf (26)
- # reagent (29)
- # reitit (9)
- # shadow-cljs (15)
- # spacemacs (3)
- # sql (4)
- # tools-build (30)
- # xtdb (41)
Is the unique identifier in an RDF IRI allowed to contains slashes, i.e. if the namespace is
is the full IRI allowed to be
? I cannot find anything on this.
Yes.
In SPARQL and turtle (and other but not all serialisation formats), you can specify a BASE
e.g.:
BASE < >
SELECT *
WHERE { BIND(<foo/bar> as ?uri) }
This establishes a base uri, which lets you use relative URI paths. If you want to use the BASE as a URI you simply write <>
.Strictly speaking keywords are not incompatible… will reply on main thread.
I would like to do it and it seems like it’s allowed (and even pretty nice), but it also really conflicts with how keywords work in Clojure
you can create them just fine in Clojure (and retrieve their namespace), but the second part breaks in ClojureScript
another thing I noticed is that the name
part of a keyword https://clojure.org/reference/reader which would also break a bunch of RDF IRIs in the form of namespaced keywords. This part is strange and doesn’t even seem enforced.
(keyword "foo.bar.baz/quux.quibble") ;; => :foo.bar.baz/quux.quibble
You’re just experiencing a difference between readable forms and the allowed values a keyword can take (anything)… e.g. (keyword "") ;;=> :
Not saying this is helpful for you
ahh sorry missed the bit about clojurescript
not 100% sure what the behaviour is there
not entirely sure either… it doesn’t happen with keywords created on the CLJS side, but it doesn’t occur with keywords that are transferred via Transit from the backend… so perhaps the extra slashes are messing with transit decoding
ahh well if you have transit; they may not be compatible with the transit spec.
though you should be able to define a custom codec for them
yeah… it’s quite strange, I can’t quite pinpoint where the issue is… transit just does (keyword s)
(prn subject
(type subject)
(namespace subject)
(name subject))
(prn (keyword "dn" "synset/42986")
(type (keyword "dn" "synset/42986"))
(namespace (keyword "dn" "synset/42986"))
(name (keyword "dn" "synset/42986")))
returns (in ClojureScript)
:dn/synset/42986 cljs.core/Keyword nil "dn"
:dn/synset/42986 cljs.core/Keyword "dn" "synset/42986"
subject
is the keyword from the backend.
Somehow it looks the same as the value created directly on the frontend, but the name
becomes the namespace
and the namespace
is nil
. so strange.
ah no wait, the same stuff happens with (keyword "dn/synset/42986")
. I see. So that’s the issue.
(fn [s]
(let [[ns identifier] (str/split s #"/" 2)]
(if identifier
(keyword ns identifier)
(keyword s))))
that fixed it! (an alternative transit handler for keywords)still I don’t think I will venture down this path as Clojure seems determined to fight me
I wrestled with this stuff a while back myself. You may be interested in https://github.com/ont-app/vocabulary/blob/master/src/ont_app/vocabulary/format.cljc