class ROCrate::ContextualEntity
A class to represent a “Contextual Entity” within an RO-Crate. Contextual Entities are used to describe and provide context to the Data Entities within the crate.
Public Class Methods
format_local_id(id)
click to toggle source
Calls superclass method
# File lib/ro_crate/model/contextual_entity.rb, line 6 def self.format_local_id(id) i = super i.start_with?('#') ? i : "##{i}" end
specialize(props)
click to toggle source
Return an appropriate specialization of ContextualEntity
for the given properties. @param props [Hash] Set of properties to try and infer the type from. @return [Class]
# File lib/ro_crate/model/contextual_entity.rb, line 15 def self.specialize(props) type = props['@type'] type = [type] unless type.is_a?(Array) if type.include?('Person') ROCrate::Person elsif type.include?('Organization') ROCrate::Organization elsif type.include?('ContactPoint') ROCrate::ContactPoint else self end end