talis/tripod-php

_link_ should be a value function on whatever is in predicate

Opened this issue · 2 comments

Currently, the predicate property is required, but ignored for link fields.

For predicates that are URIs, you should be able to:

"fieldName":"fooLink",
"predicates":["foo:uri"]
"value":"_link_"

and it creates a fully qualified URI from the value of foo:uri.u (as opposed to _id.r).

There are a few questions, however:

  1. What happens if there is more than 1 value in "predicates"?
  2. What if "predicates" value is not a URI?

I would say:

  1. All of them get the _link_ treatment
  2. I would say just output the literal value. Although it makes little sense to apply a _link_ to a literal, I'm not sure it should be a fail condition. Especially seeing that the predicates array could be a mixed economy of resources and literals, and bad data modelling decisions could even see different values same predicate having literal and resource versions.

Yeah, both of those seem reasonable to me.