Skip to content

Instantly share code, notes, and snippets.

@anarchivist
Created August 3, 2015 21:49
Show Gist options
  • Select an option

  • Save anarchivist/5871386282e4d34c888e to your computer and use it in GitHub Desktop.

Select an option

Save anarchivist/5871386282e4d34c888e to your computer and use it in GitHub Desktop.
DPLA::MAP weirdness
irb(main):299:0> sr = DPLA::MAP::SourceResource.new
=> #<DPLA::MAP::SourceResource:0x3fc04197f6d0(default)>
irb(main):300:0> sr.title = "A title"
=> "A title"
irb(main):301:0> type_value = DPLA::MAP::Controlled::DCMIType.new
=> #<DPLA::MAP::Controlled::DCMIType:0x3fc04194fdf4(default)>
irb(main):302:0> type_value.providedLabel = "image"
=> "image"
irb(main):303:0> sr.dctype = type_value
=> #<DPLA::MAP::Controlled::DCMIType:0x3fc04194fdf4(default)>
irb(main):304:0> subj = DPLA::MAP::Concept.new
=> #<DPLA::MAP::Concept:0x3fc041934554(default)>
irb(main):305:0> subj.providedLabel = "Nonsense"
=> "Nonsense"
irb(main):306:0> sr.subject = subj
=> #<DPLA::MAP::Concept:0x3fc041934554(default)>
irb(main):307:0> language_value = DPLA::MAP::Controlled::Language.new
=> #<DPLA::MAP::Controlled::Language:0x3fc0419279d0(default)>
irb(main):308:0> language_value.providedLabel = "fre"
=> "fre"
irb(main):309:0> sr.language = language_value
=> #<DPLA::MAP::Controlled::Language:0x3fc0419279d0(default)>
irb(main):310:0> puts sr.dump :ttl
_:g70094966553760 a <http://www.w3.org/2000/01/rdf-schema#Class>;
<http://dp.la/about/map/providedLabel> "image" .
[
a <http://dp.la/about/map/SourceResource>;
<http://purl.org/dc/terms/title> "A title";
<http://purl.org/dc/terms/language> [
a <http://www.w3.org/2004/02/skos/core#Concept>;
<http://dp.la/about/map/providedLabel> "fre"
];
<http://purl.org/dc/terms/subject> [
a <http://www.w3.org/2004/02/skos/core#Concept>;
<http://dp.la/about/map/providedLabel> "Nonsense"
];
<http://purl.org/dc/terms/type> _:g70094966553760
] .
=> nil
irb(main):311:0> sr.dctype
=> [#<DPLA::MAP::Controlled::DCMIType:0x3fc04194fdf4(default)>]
irb(main):312:0> sr.title
=> ["A title"]
irb(main):313:0> sr.subject
=> [#<DPLA::MAP::Concept:0x3fc041934554(default)>]
irb(main):314:0> sr.language
=> []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment