relevance / diametric

Diametric is a library for building schemas, queries, and transactions for Datomic from Ruby objects.
MIT License
169 stars 28 forks source link

URI type raises exception #21

Closed yokolet closed 10 years ago

yokolet commented 11 years ago

REST and Peer raise different exceptions, but both raise an exception when :db.type/uri is specified.

yokolet commented 11 years ago

I'm digging into this issue, but there's little hope for REST connection.

There're two factors related to this bug, edn-ruby and REST client.

I changed edn code, so now edn looks able to handle URI type. However, Datomic's REST client looks not to accept URI type.

Here're what I tried: I created schema below from browser connecting to datomic rest service.

tx-data

[{:db/id #db/id[:db.part/db]
  :db/ident :person/uri
  :db/valueType :db.type/uri
  :db/cardinality :db.cardinality/one
  :db/doc "A person's uri"
  :db.install/_attribute :db.part/db}]

then, type below to create entity:

tx-data

[{:db/id #db/id[:db.part/user]
  :person/uri "\"http://google.com\""}]

The result was:

:transact/bad-data Value "http://google.com" is not a valid :uri for attribute :person/uri

Datomic expects java.net.URI for :db.type/uri, so my guess is that uri is not supported for REST connection.

I'll leave REST connection support for a while since it looks beyond diametric and edn-ruby. Instead, I'll work on Peer connection.

avescodes commented 11 years ago

Darn, it would be really nice to be able to keep feature parity. I'll toy with edn-ruby and datomic-client to see if there is any way to work in URI support.

yokolet commented 10 years ago

Eventually, Diametric decided not to support URI type.

The reason is: When URI type is specified, Datomic tries to pull whole contents of the given URL and save those as a static data. Probably, saving URL as a string would work and be more flexible.