knocean / knode

Knowledge Development Environment
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Prefer label to IRI, curie or HREF for query result display #57

Closed inaimathi closed 6 years ago

inaimathi commented 6 years ago

Mergeable. Currently resolves https://github.com/knocean/knode/issues/53 and https://github.com/knocean/knode/issues/54. Realistically could use some minor refactoring around result->edn.

jamesaoverton commented 6 years ago

Thanks. My only worry is that if the SPARQL contains a double-quoted literal, and that literal contains a single-quoted string, then it will get substituted. Is that right? We don't want that. Example:

(is (= "\"Leave this 'keyword' alone\""
       (q/-substitute-single-quotes
         (atom {:env {:labels {"keyword" {:curie "foo:bar" :iri "www.foo.com/bar"}}}})
         "\"Leave this 'keyword' alone\"")))

SPARQL queries are never very big, so even though we found Instaparse to be slow, we could use it for this case. Eventually I would like to adapt this to Turtle files, which can be large, so it would be nice to keep it fast.

inaimathi commented 6 years ago

Added the above test case to this, and it passes with the revised regex (both here and locally).