Open Robsteranium opened 7 years ago
@RickMoynihan has also suggested that these could be loaded into the registry as a consequence of loading the vocab namespace.
Also that:
I’d also recommend considering storing the prefix values in that map as tuples like
[:skos :Concept]
as I’d also like at some point to adddata_readers
for tagged literals like#grafter/uri [:skos :Concept]
which would probably automatically load from edn as a URI…. also that tag would also work for#grafter/uri "http://"
… we’d have a tag for#grafter/prefix [:skos :Concept]
too — so e.g.#grafter/uri #grafter/prefix [:skos :Concept]
would also do the right thing
This is more or less exactly what I was thinking. Thanks for taking the time to write it up.
I think this should be the prefered way to define a prefix:
(defprefix :skos "http://www.w3.org/2004/02/skos/core#")
Also curie->uri
should be a protocol so we can do the following:
(= (curie->uri "skos:Concept")
(curie->uri [:skos :Concept])) ;; => true
I'd expect this to be two protocol definitions one for String
and the other extending to the appropriate IPersistentVector
. I think the canonical representation of a curie should be the vectorised form of [:skos :Concept]
though so uri->curie
should return that. I am all for having a convenience function for uri->curie-str
though.
To clarify my above suggestion: "that these could be loaded into the registry as a consequence of loading the vocab namespace.". I think that this means loading the skos
namespace should register the skos
prefix for you too, but none skos prefixes shouldn't be loaded. i.e. we should do what you expect and no more.
Oh also agree defprefix
should be implemented to coerce strings and URI's; but all of them should be canonicalised to java.net.URI
for reasons of equality etc.
Terminology wise I think we should use the more common term prefix
over curi
though.
It would be nice to be able to expand CURIEs. We could do this with some sort of registry of prefixes.
Defining prefixes
We'd have an atom to act as a registry for prefixes. This would relate (with a hashmap) a prefix to a base URL.
I'm not sure whether the prefix param should be a symbol, keyword (namespaced-keyword), or string... (or perhaps to provide an interface where more than one works).
And we might want the uri to be a URI instead of a string... (coercing it might be more convenient)
Using prefixes
Intern'd vars?
Not sure how this relates to e.g.
skos:Concept
- or if it even needs to...