You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All nice and easy: the value from the single column countryRef is bound to the resource described by the row that has the matching value in primary key column countryCode so that one can link the two tables together.
However, Example 9 from 3.1 Property Syntax shows a composite primary key definition:
"primaryKey": [ "givenName", "familyName" ]
We know from this definition that there is a constraint such that the combination of givenName and familyName for a given row must be unique within the table.
But if I want to create a foreign key reference to a given row specified with a composite primary key, what would the value in the referencing column (cell) look like?
In this case I want to say that the value of person in table 2 maps on to the row with matching primary key from table 1. Somehow I need to map "person": "Jeremy Tandy" to "givenName": "Jeremy", "familyName": "Tandy".
It seems to me that we need to describe how the value in table 2 person maps onto the columns in table 1.
(I know this is a contrived example because all the github identifiers must be unique - but hey ...)
I wonder if we can use the URI Template syntax for this? e.g. for table 2 ...
Does it even make sense to have a foreign key reference from an array of columns? I can't think where a foreign key reference would not relate from the value in a single column. Should it be permissible to provide an array of columns in a foreign key definition (e.g. foreignKeys/columns)? Should we limit ourselves to a single column?
It might even make sense to define the primary key in the same way; e.g. for table 1
"primaryKey": "{givenName} {familyName}"
(Note that this also affects how the @id in mapped RDF is generated)