Class: LinkedRails::Ontology
- Inherits:
-
Object
- Object
- LinkedRails::Ontology
- Includes:
- ActiveModel::Model, Model, Model::Cacheable
- Defined in:
- app/models/linked_rails/ontology.rb,
app/models/linked_rails/ontology/base.rb,
app/models/linked_rails/ontology/class.rb,
app/models/linked_rails/ontology/property.rb,
app/serializers/linked_rails/ontology/class_serializer.rb,
app/serializers/linked_rails/ontology/property_serializer.rb
Defined Under Namespace
Classes: Base, Class, ClassSerializer, Property, PropertySerializer
Constant Summary
Constants included from Model::Collections
Model::Collections::COLLECTION_CUSTOMIZABLE_OPTIONS, Model::Collections::COLLECTION_OPTIONS, Model::Collections::COLLECTION_STATIC_OPTIONS
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Model::Cacheable
#cacheable?, #publish_create, #publish_delete, #publish_update
Methods included from Model
Methods included from Model::Singularable
#root_relative_singular_iri, #singular_iri, #singular_iri?, #singular_iri_opts, #singular_iri_template, #singular_resource?
Methods included from Model::Serialization
#preview_includes, #show_includes
Methods included from Model::Menuable
Methods included from Model::IRI
#anonymous_iri, #anonymous_iri?, #iri, #iri_elements, #iri_opts, #rdf_type, #reload, #route_fragment
Methods included from Model::Enhancements
Methods included from Model::Dirty
Methods included from Model::Collections
#collection_for, #collection_iri, #collection_options_for, #collection_root_relative_iri, #parent_collections
Methods included from Model::Actionable
#action, #action_list, #action_triples, #actions, #collection_actions, #favorite_actions
Class Method Details
.preview_includes ⇒ Object
26 27 28 |
# File 'app/models/linked_rails/ontology.rb', line 26 def preview_includes %i[classes properties] end |
.requested_resource(opts, _user_context) ⇒ Object
30 31 32 |
# File 'app/models/linked_rails/ontology.rb', line 30 def requested_resource(opts, _user_context) LinkedRails.ontology_class.new if opts[:iri].include?(new.root_relative_iri) end |
Instance Method Details
#classes ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/models/linked_rails/ontology.rb', line 9 def classes @classes ||= LinkedRails.linked_models.map do |klass| iri = klass.iri.is_a?(Array) ? klass.iri.first : klass.iri LinkedRails.ontology_class_class.new(klass: klass, iri: iri) if iri end.compact end |
#properties ⇒ Object
17 18 19 |
# File 'app/models/linked_rails/ontology.rb', line 17 def properties classes.flat_map(&:properties) end |
#root_relative_iri ⇒ Object
21 22 23 |
# File 'app/models/linked_rails/ontology.rb', line 21 def root_relative_iri RDF::URI('/ns/core') end |