You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Turtle
@prefix foaf:    <http://xmlns.com/foaf/0.1> .

<http://vivo.cornell.edu/individual/individual24416> a foaf:Person, foaf:Agent .
Turtle
@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 that..." ;
  dc:creator           <http://vivo.cornell.edu/individual/individual24416> ;
  ore:aggregates <http://da-rdf.library.cornell.edu/individual/b7141838> ;
  ore:aggregates <http://da-rdf.library.cornell.edu/individual/b4004406> ;
  ore:aggregates <http://da-rdf.library.cornell.edu/individual/b304862> .

 

CHANGE DESCRIPTION OF ENGINEERING HANDBOOK

 

 

 

Turtle using ORE ontology's Aggregation class
@prefix ore:     <http://www.openarchives.org/ore/terms/> .
@prefix iana:    <http://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> .
Turtle
@prefix rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dcterms:  <http://purl.org/dc/terms> .
@prefix dctypes:   <http://purl.org/dc/dcmitype> .
@prefix cnt:      <http://www.w3.org/2011/content#> .
@prefix oa:       <http://www.w3.org/ns/oa> .
 
<http://localhost:3000/individual/cm93> a oa:Annotation ;
  oa:hasTarget <http://localhost:3000/individual/vci162> ;
  oa:hasBody <http://localhost:3000/individual/ab205> ;
  oa:annotatedBy <http://vivo.cornell.edu/individual/individual24416> ;
  oa:annotatedAt "2014-07-21T12:00:00Z"^^xsd:dateTime
  oa:motivatedBy oa:commenting .

<http://localhost:3000/individual/ab205> a dctypes:Text, cnt:ContentAsText ;
  cnt:chars      "This is my favorite book." ;
  dcterms:format "text/plain" .

 

 

Dir["lib/ld4l/virtual_collection_rdf/vocab/*.rb"].each {|file| require file[4,file.size-3] }
module LD4L
  module VirtualCollectionRDF
    class Collection < LD4L::VirtualCollectionRDF::ResourceExtension
      @id_prefix="vc"
      configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::VirtualCollectionRDF.configuration.base_uri, :repository => :default

      # extended properties for LD4L implementation
      property :title,       :predicate => RDF::DC.title
      property :description, :predicate => RDF::DC.description
      property :owner,       :predicate => RDFVocabularies::DCTERMS.creator, :class_name => LD4L::VirtualCollectionRDF::Person

      # properties from ORE.Aggregation
      property :aggregates,   :predicate => RDFVocabularies::ORE.aggregates   # multiple values

      # ------------------------------- #
      #  Collection Maintenance Methods #
      # ------------------------------- #

      # Create a virtual collection in one step passing in the required information.  TODO: Are any of the inputs optional?
      def self.create( options = {} )
        id             = options[:id]          || generate_id
        vc = LD4L::VirtualCollectionRDF::Collection.new(id)
        vc.title       = options[:title]       || []
        vc.description = options[:description] || []
        vc.owner       = options[:owner]       || []
        vc
      end

      # Add a single item URI to the items for the virtual collection.  ORE ontology style lists.
      # Optionally insert the item at the passed position.  Append when position is nil.
      def add_item_with_content(content,insert_position=nil)
        aggregates = self.aggregates.dup
        aggregates << content
        self.aggregates = aggregates
        LD4L::VirtualCollectionRDF::Item.create(:content => content, :virtual_collection => self, :insert_position => insert_position)
      end

      # Adds each item in the item_array to the items for the virtual collection
      def add_items_with_content(content_array)
        vci_array = []
        content_array.each { |content| vci_array << add_item_with_content(content) }
        vci_array
      end
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 = 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

 

 

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
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 :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::VirtualCollectionRDF.configuration.base_uri, :repository => :default

      # extended properties for LD4L implementation
      property :title,       :predicate => RDF::DC.title
      property :description, :predicate => RDF::DC.description
      property :owner,       :predicate => RDFVocabularies::DCTERMS.creator, :class_name => LD4L::VirtualCollectionRDF::Person

      # properties from ORE.Aggregation
      property :aggregates,   :predicate => RDFVocabularies::ORE.aggregates   # multiple values
    end
  end
end
module RDFTypes
  class OpenAnnotationRDF < ActiveTriples::Resource
    @id_prefix="oa"

    configure :type => RDFVocabularies::OA.Annotation, :base_uri => Rails.configuration.urigenerator.base_uri, :repository => :default

    # properties from OA.Annotation
    property :hasTarget,   :predicate => RDFVocabularies::OA.hasTarget    # :type => URI
    property :hasBody,     :predicate => RDFVocabularies::OA.hasBody,     :class_name => RDFTypes::OpenAnnotationBodyRDF
    property :annotatedBy, :predicate => RDFVocabularies::OA.annotatedBy, :class_name => RDFTypes::PersonRDF
    property :annotatedAt, :predicate => RDFVocabularies::OA.annotatedAt  # :type => xsd:dateTime    # the time Annotation was created
    property :motivatedBy, :predicate => RDFVocabularies::OA.motivatedBy  # comes from RDFVocabularies::OA ontology
  end
end

module RDFTypes
  class OpenAnnotationBodyRDF < ActiveTriples:Resource
    @id_prefix="oab"

    configure :base_uri => Rails.configuration.urigenerator.base_uri, :repository => :default

    property :type,    :predicate => RDF::type                   # :type => URI
    property :content, :predicate => RDFVocabularies::CNT.chars  # :type => XSD.string
    property :format,  :predicate => RDF::DC.format              # :type => XSD.string
  end
end

 

 

 

 

 

 

  • No labels