Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Predicates instead of Use Classes? #43

Open
azaroth42 opened this issue Apr 20, 2016 · 5 comments
Open

Use Predicates instead of Use Classes? #43

azaroth42 opened this issue Apr 20, 2016 · 5 comments

Comments

@azaroth42
Copy link
Contributor

Talked through the current postcard model with @jcoyne and @mjgiarlo this morning, and this came from that discussion.

It would be easier to use predicates for the relationship between Object and FileSet, and between FileSet and Files than to look for classes on the child resource.

In particular, the clinching use case was an Object with two FileSets, one for Image depiction and one for TEI transcription. The question came up: How do I know that I can display the TEI file (or likely a pre-processed derivative) as the text of the Object? With Use, the TEI file would need to be both OriginalFile and ExtractedText, and all derivatives would be ExtractedText. So the processing requirement would be:

For each FileSet,
  For each File,
    If the File is a use:ExtractedText,
      Record it
Pick one of the ExtractedTexts to render

It seemed easier to link from the Object to the TEI FileSet with a relationship, rather than filtering like this. Similarly, filtering the Files for the OriginalFile rather than following a "hasOriginalFile" relationship seemed significantly easier.

So, the proposal is to continue with a single container for Files (and FileSets, issue forthcoming) and also add a relationship from the parent to the child.

@tpendragon
Copy link

Isn't this contrary to #44? Or are you proposing both hasFileSet and hasOriginalFile statements?

@azaroth42
Copy link
Contributor Author

Both. hasFileSet / hasFile for the direct containers to look after the content, and then additional predicates to clarify use within the parent.

@escowles
Copy link

So you would use both hasFile and, e.g., hasThumbnail? When you wanted a thumbnail, you'd use the hasThumbnail predicate, but if you didn't care about the type of File, you'd just use hasFile?

That seems like good functionality on the read side of things, but adds to the overhead on the create side of things. I'm fine with that tradeoff (since I expect most repositories get a lot more reads than writes), but it's worth noting that it's a tradeoff.

@azaroth42
Copy link
Contributor Author

Agree that it's a tradeoff. Hopefully the number of changes to these would be low, and possible to do after the initial load. The POST would go to the hasFile container, then a PATCH on the object to add the hasThumbnail (or whatever) predicate. And yes, if it's just a file, then no subsequent PATCH.

@tpendragon
Copy link

Mmph. I didn't even think about the extra PATCH. That would be pretty unpleasant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants