...
Code Block | ||||
---|---|---|---|---|
| ||||
@prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix dcterms: <http://purl.org/dc/terms> . @prefix ore: <http://www.openarchives.org/ore/terms/> . <http://localhost:3000/individual/vc155> a ore:Aggregation ; dcterms:title "Engineering Handbooks" ; dcterms:description "These are resources I am gathering together for personal usethat..." ; dc:creator <http://vivo.cornell.edu/individual/individual24416> . |
CHANGE DESCRIPTION OF ENGINEERING HANDBOOK
Code Block | ||||
---|---|---|---|---|
| ||||
@prefix ore: ; ore:aggregates <http://www.openarchives.org/ore/terms/> . @prefix iana: <http://www.iana.org/assignments/relation/> . <http://localhost:3000/individual/vc155> a ore:Aggregation ; ore:aggregates <http://da-rdf.library.cornell.edu/individual/b7141838> ; ore:aggregates <http://da-rdf.library.cornell.edu/individual/b7141838>b4004406> ; ore:aggregates <http://da-rdf.library.cornell.edu/individual/b304862> . |
CHANGE DESCRIPTION OF ENGINEERING HANDBOOK
Code Block | ||||
---|---|---|---|---|
| ||||
@prefix ore: b4004406> ; ore:aggregates <http://da-rdfwww.library.cornell.edu/individual/b304862>openarchives.org/ore/terms/> . @prefix iana: <http://localhost:www.iana.org/assignments/relation/> . <http://localhost:3000/individual/vci162> a ore:Proxy ; ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b7141838> ; ore:proxyIn <http://localhost:3000/individual/vc155> ; iana:next <http://localhost:3000/individual/vci163> . <http://localhost:3000/individual/vci163> a ore:Proxy ; ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b4004406> ; ore:proxyIn <http://localhost:3000/individual/vc155> ; iana:previous <http://localhost:3000/individual/vci162> ; iana:next <http://localhost:3000/individual/vci164> . <http://localhost:3000/individual/vci164> a ore:Proxy ; ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b304862> ; ore:proxyIn <http://localhost:3000/individual/vc155> ; iana:previous <http://localhost:3000/individual/vci163> . |
...
Code Block | ||
---|---|---|
| ||
Dir["lib/ld4l/virtual_collection_rdf/vocab/*.rb"].each {|file| require file[4,file.size-3] } module LD4L module VirtualCollectionRDF class Item < LD4L::VirtualCollectionRDF::ResourceExtension @id_prefix="vci" configure :type => RDFVocabularies::ORE.Proxy, :base_uri => LD4L::VirtualCollectionRDF.configuration.base_uri, :repository => :default # common properties property :contributor, :predicate => RDF::DC.contributor, :class_name => LD4L::VirtualCollectionRDF::Person # properties from ORE.Proxy property :proxyFor, :predicate => RDFVocabularies::ORE.proxyFor property :proxyIn, :predicate => RDFVocabularies::ORE.proxyIn, :class_name => LD4L::VirtualCollectionRDF::Collection property :next, :predicate => RDFVocabularies::IANA.next, :class_name => LD4L::VirtualCollectionRDF::Item property :previous, :predicate => RDFVocabularies::IANA.previous, :class_name => LD4L::VirtualCollectionRDF::Item # ------------------------------- # # Collection Maintenance Methods # # ------------------------------- # # Create a virtual collection item in one step passing in the required information. ORE ontology only. # options: # id (optional) - used to assign RDFSubject # - full URI - use as passed in # - partial id - uri generated from base_uri + id_prefix + id # - nil - uri generated from base_uri + id_prefix + random_number # virtual_collection (required) - collection to which item is being added # content (required) - content for the item being added to the collection # insert_position (optional) - used for ordered lists to place an item at a specific location (default - appends) # contributor (optional) - assumed to be list owner if not specified def self.create( options = {} ) # validate item was passed in content = options[:content] || nil raise ArgumentError, "content is required" if content.nil? # validate virtual_collection is of correct type virtual_collection = options[:virtual_collection] || nil raise ArgumentError, "virtual_collection is not LD4L::VirtualCollectionRDF::Collection" unless virtual_collection.kind_of?(LD4L::VirtualCollectionRDF::Collection) id = options[:id] || generate_id vci = LD4L::VirtualCollectionRDF::Item.new(id) # set ORE ontology properties vci.proxyFor = content vci.proxyIn = virtual_collection.kind_of?(String) ? RDF::URI(virtual_collection) : virtual_collection vci.contributor vci.contributor = options[:contributor] || [] # TODO default to vc.owner vci.type = types vci end= options[:contributor] || [] # TODO default to vc.owner vci.type = types vci end # Returns an array of the LD4L::VirtualCollectionRDF::Item instances for the items in the virtual collection def self.get_range( virtual_collection, start=0, limit=nil ) r = ActiveTriples::Repositories.repositories[LD4L::VirtualCollectionRDF::Item.repository] vci_array = [] r.query(:predicate => RDFVocabularies::ORE.proxyIn, :object => virtual_collection.rdf_subject).statements.each do |s| vci = LD4L::VirtualCollectionRDF::Item.new(s.subject) vci_array << vci end vci_array end end end end |
Code Block | ||
---|---|---|
| ||
Dir["lib/ld4l/virtual_collection_rdf/vocab/*.rb"].each {|file| require file[4,file.size-3] }
module LD4L
module VirtualCollectionRDF
class Item < ActiveTriples:Resource
@id_prefix="vci"
configure :type => RDFVocabularies::ORE.Proxy, :base_uri => LD4L::VirtualCollectionRDF.configuration.base_uri, :repository => :default
# common properties
property :contributor, :predicate => RDF::DC.contributor, :class_name => LD4L::VirtualCollectionRDF::Person
# properties from ORE.Proxy
property :proxyFor, :predicate => RDFVocabularies::ORE.proxyFor
property :proxyIn, :predicate => RDFVocabularies::ORE.proxyIn, :class_name => LD4L::VirtualCollectionRDF::Collection
property :next, :predicate => RDFVocabularies::IANA.next, :class_name => LD4L::VirtualCollectionRDF::Item
property :previous, :predicate => RDFVocabularies::IANA.previous, :class_name => LD4L::VirtualCollectionRDF::Item
end
end
end |
Code Block | ||
---|---|---|
| ||
Dir["lib/ld4l/virtual_collection_rdf/vocab/*.rb"].each {|file| require file[4,file.size-3] } module LD4L module VirtualCollectionRDF class Collection < ActiveTriples::Resource @id_prefix="vc" #configure Returns:type an array of the=> RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::VirtualCollectionRDF::Item instances for the items in the virtual collection.configuration.base_uri, :repository => :default def self.get_range( virtual_collection, start=0, limit=nil )# extended properties for LD4L implementation r = ActiveTriples::Repositories.repositories[LD4L::VirtualCollectionRDF::Item.repository] property :title, vci_array = []:predicate => RDF::DC.title property r.query(:description, :predicate => RDFVocabulariesRDF::OREDC.proxyIn,description property :owner, :objectpredicate => virtual_collection.rdf_subject).statements.each do |s| vci =RDFVocabularies::DCTERMS.creator, :class_name => LD4L::VirtualCollectionRDF::Item.new(s.subject)Person # properties vci_array << vcifrom ORE.Aggregation property :aggregates, end :predicate => RDFVocabularies::ORE.aggregates # vci_array endmultiple values end end end |