Last active
December 9, 2015 14:11
-
-
Save elrayle/b62003b432e0722c8c72 to your computer and use it in GitHub Desktop.
ordered_members vs. members and their interactions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # How do ordered_members and members behave and interact | |
| # Setup | |
| col1 = Hydra::Works::Collection.new(id: 'c1') | |
| wrk1 = Hydra::Works::Work.new(id: 'w1') | |
| wrk2 = Hydra::Works::Work.new(id: 'w2') | |
| wrk3 = Hydra::Works::Work.new(id: 'w3') | |
| wrk4 = Hydra::Works::Work.new(id: 'w4') | |
| # 1. adding to members does NOT add to ordered members | |
| col1.members << wrk1 | |
| col1.members.size # => 1 -- w1 | |
| Array(col1.ordered_members).size # => 0 | |
| # 2. adding to ordered_members does add to members | |
| col1.ordered_members << wrk4 | |
| col1.members.size # => 2 -- w1, w4 (order unimportant) | |
| Array(col1.ordered_members).size # => 1 -- w4 | |
| # 3. adding the same object again to ordered_members does NOT add to members | |
| col1.ordered_members << wrk4 | |
| col1.members.size # => 2 -- w1, w4 (order unimportant) | |
| Array(col1.ordered_members).size # => 2 -- w4, w4 (precise order) | |
| # add a few more to work with for deletes | |
| col1.ordered_members << wrk2 | |
| col1.ordered_members << wrk3 | |
| col1.members.size # => 4 -- w1, w2, w3, w4 (order unimportant) | |
| Array(col1.ordered_members).size # => 4 -- w4, w4, w2, w3 (precise order) | |
| # 3. deleting from members does NOT effect ordered_members | |
| col1.members.delete(wrk3) | |
| col1.members.size # => 3 -- w1, w2, w4 (order unimportant) | |
| Array(col1.ordered_members).size # => 4 -- w4, w4, w2, w3 (precise order) | |
| # 4. deleting from ordered_members does NOT effect members | |
| col1.ordered_members.delete_at(2) | |
| col1.members.size # => 3 -- w1, w2, w4 (order unimportant) | |
| Array(col1.ordered_members).size # => 2 -- w4, w4, w3 (precise order) | |
Author
@tpendragon is that actually specified in PCDM?
Author
Actual triples created in Fedora
NOTE: These examples only include triples related to PCDM, ORE, and LDP. Fedora keeps additional triples and each object has additional rdf types that aren't shown here.
Set: Add one work to a collection without order
Code to create set:
col1.members << work1
col1.members << work2
col1.members << work3
Triples in Fedora necessary to represent a set using ORE:
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
<http://localhost:8983/fedora/rest/dev/col-1> a pcdm:Collection ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> .
Triples in Fedora for LDP and ORE: (includes the ORE triples from above)
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
<http://localhost:8983/fedora/rest/dev/col-1> a pcdm:Collection, ldp:Container, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-1/members> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> .
<http://localhost:8983/fedora/rest/dev/col-1/members> a ldp:Container, ldp:IndirectContainer, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-1/members/2aa40a84-8011-4bcd-8167-15f115b55d06> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-1/members/62fc559f-641a-43dc-9951-8425ed690037> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-1/members/9cfcdcdd-ab10-4822-9293-c4e100fc96e8> ;
ldp:hasMemberRelation pcdm:hasMember ;
ldp:insertedContentRelation ore:proxyFor ;
ldp:membershipResource <http://localhost:8983/fedora/rest/dev/col-1> .
<http://localhost:8983/fedora/rest/dev/col-1/members/2aa40a84-8011-4bcd-8167-15f115b55d06> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-2> .
<http://localhost:8983/fedora/rest/dev/col-1/members/62fc559f-641a-43dc-9951-8425ed690037> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-3> .
<http://localhost:8983/fedora/rest/dev/col-1/members/9cfcdcdd-ab10-4822-9293-c4e100fc96e8> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> .
Fully Ordered List: Add three works to a collection with order
Code to create fully ordered list:
col2.ordered_members << work1
col2.ordered_members << work2
col2.ordered_members << work3
Triples in Fedora necessary to represent a fully ordered list using ORE:
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
<http://localhost:8983/fedora/rest/dev/col-2> a pcdm:Collection ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> .
NOTE: Each of the list_source proxies should have an rdf type of ore:proxy. Not sure why they don't.
Triples in Fedora for LDP and ORE: (includes the ORE triples from above)
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
@prefix dct: <http://purl.org/dc/terms/> .
<http://localhost:8983/fedora/rest/dev/col-2> a pcdm:Collection, ldp:Container, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-2/list_source> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-2/members> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> .
<http://localhost:8983/fedora/rest/dev/col-2/members> a ldp:Container, ldp:IndirectContainer, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-2/members/bac2feff-8010-4011-9192-de0a79dd13f7> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-2/members/e148c0f5-3038-4311-b39f-0dc4eb7d783a> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-2/members/fd47fa85-08b4-4b27-86d0-329d7d8bc371> ;
ldp:hasMemberRelation pcdm:hasMember ;
ldp:insertedContentRelation ore:proxyFor ;
ldp:membershipResource <http://localhost:8983/fedora/rest/dev/col-2> .
<http://localhost:8983/fedora/rest/dev/col-2/members/bac2feff-8010-4011-9192-de0a79dd13f7> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> .
<http://localhost:8983/fedora/rest/dev/col-2/members/e148c0f5-3038-4311-b39f-0dc4eb7d783a> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-3> .
<http://localhost:8983/fedora/rest/dev/col-2/members/fd47fa85-08b4-4b27-86d0-329d7d8bc371> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-2> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source> a ldp:Container, ldp:RDFSource ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099634570060> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> .
<http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638308040> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-2> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-2/list_source#g70099638588660> .
Partially Ordered List: Add three works to a collection with order and 3 without order
Code to create partially ordered list:
col3.members << work1
col3.ordered_members << work2
col3.ordered_members << work3
col3.members << work4
col3.ordered_members << work5
col3.members << work6
Triples in Fedora necessary to represent a partially ordered list using ORE:
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
<http://localhost:8983/fedora/rest/dev/col-3> a pcdm:Collection ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-4> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-5> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-6> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-2> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-3> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-5> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> .
NOTE: Each of the list_source proxies should have an rdf type of ore:proxy. Not sure why they don't.
Triples in Fedora for LDP and ORE: (includes the ORE triples from above)
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
@prefix dct: <http://purl.org/dc/terms/> .
<http://localhost:8983/fedora/rest/dev/col-3> a pcdm:Collection, ldp:Container, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/list_source> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-1> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-2> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-3> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-4> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-5> ;
pcdm:hasMember <http://localhost:8983/fedora/rest/dev/work-6> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> .
<http://localhost:8983/fedora/rest/dev/col-3/members> a ldp:Container, ldp:IndirectContainer, ldp:RDFSource ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/b362baa2-f803-4c6b-b8e8-44a25d64ea71> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/be70870b-54c1-4632-8347-d685ec756d44> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/c845ffbd-cdc3-42ca-8334-6f61cc20b9c3> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/d74e2ea1-dd0d-48b9-a5d7-942d732fc06b> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/e0ffc9a7-8934-4ce0-995f-a9ac8d93f554> ;
ldp:contains <http://localhost:8983/fedora/rest/dev/col-3/members/e1bf5600-860d-47cb-bad4-0326a9376c0a> ;
ldp:hasMemberRelation pcdm:hasMember ;
ldp:insertedContentRelation ore:proxyFor ;
ldp:membershipResource <http://localhost:8983/fedora/rest/dev/col-3> .
<http://localhost:8983/fedora/rest/dev/col-3/members/b362baa2-f803-4c6b-b8e8-44a25d64ea71> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-1> .
<http://localhost:8983/fedora/rest/dev/col-3/members/be70870b-54c1-4632-8347-d685ec756d44> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-3> .
<http://localhost:8983/fedora/rest/dev/col-3/members/c845ffbd-cdc3-42ca-8334-6f61cc20b9c3> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-2> .
<http://localhost:8983/fedora/rest/dev/col-3/members/d74e2ea1-dd0d-48b9-a5d7-942d732fc06b> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-4> .
<http://localhost:8983/fedora/rest/dev/col-3/members/e0ffc9a7-8934-4ce0-995f-a9ac8d93f554> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-6> .
<http://localhost:8983/fedora/rest/dev/col-3/members/e1bf5600-860d-47cb-bad4-0326a9376c0a> a ore:Proxy, ldp:Container, ldp:RDFSource ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-5> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source> a ldp:Container, ldp:RDFSource ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> ;
dct:hasPart <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:first <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:last <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-2> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-3> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159014522900> ;
iana:next <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> .
<http://localhost:8983/fedora/rest/dev/col-3/list_source#g70158983424840> a ;
ore:proxyFor <http://localhost:8983/fedora/rest/dev/work-5> ;
ore:proxyIn <http://localhost:8983/fedora/rest/dev/col-3> ;
iana:prev <http://localhost:8983/fedora/rest/dev/col-3/list_source#g70159013851360> .
Author
The set of triples that are being generated in Fedora do not appear to match the concept of Resource Map described in the ORE spec. If you see this differently, can you explain how you understand this implementation to match ORE Resource Maps?
What is a use case for a partial_ordered list?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Blend of Approach 2 and 3
Approach 2 could become more intuitive with some adjustments to the API. Currently, it seems like there are two lists (members and ordered_members) being kept for one aggregation. They seem to effect each other in a non-intuitive way. There aren’t actually two lists, but the API treats them in a way that implies they are separate. Trey pointed out in another email that "#ordered_members is a convenience method for returning the proxyFor objects, in order, pointed at from the ordered list.”
A potential change to the API could strengthen the concept that members is a single aggregation. Method changes to support this could be a blend of Approach 2 and 3. Keep the infrastructure currently in place with Approach 2. Change the public methods to be those of Approach 3 where all changes are made to members to effect set operations and ordered list operations. col1.ordered_members would not be a valid call anymore. Instead views into the aggregation as a set or list would be handled by the following methods. NOTE: col1 is an example PCDM:Collection that has aggregation members.