Class: OpenBEL::Routes::Nanopubs

Inherits:
Base
  • Object
show all
Includes:
BELParser::Parsers, Helpers, Nanopub::FacetFilter, OpenBEL::Resource::Nanopub
Defined in:
app/openbel/api/routes/nanopubs.rb

Constant Summary

Constants included from Helpers

Helpers::DEFAULT_CONTENT_TYPE, Helpers::DEFAULT_CONTENT_TYPE_ID

Constants included from Nanopub::FacetFilter

Nanopub::FacetFilter::EMPTY, Nanopub::FacetFilter::NANOPUB_PARTS

Constants inherited from Base

Base::DEFAULT_CONTENT_TYPE, Base::DEFAULT_CONTENT_TYPE_ID, Base::RESOURCE_SERIALIZERS, Base::SCHEMA_BASE_URL, Base::SPOKEN_CONTENT_TYPES

Constants included from Schemas

Schemas::COMPILED_SCHEMAS, Schemas::SCHEMA_DIR, Schemas::SUFFIX

Constants included from OpenBEL::Resource::Namespaces

OpenBEL::Resource::Namespaces::VOCABULARY_RDF

Constants included from OpenBEL::Resource::Annotations

OpenBEL::Resource::Annotations::VOCABULARY_RDF

Instance Method Summary collapse

Methods included from Helpers

#incomplete_filters, #invalid_fts_filters, #parse_filters, #render_nanopub_collection, #validate_experiment_context, #validate_filters!, #validate_nanopub!, #validate_statement, #wants_default?

Methods included from Nanopub::FacetFilter

#make_filter, #map_citation_facets, #map_experiment_context_facets, #map_metadata_facets, #map_nanopub_facets

Methods included from Schemas

#validate

Constructor Details

#initialize(app) ⇒ Nanopubs

Returns a new instance of Nanopubs.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/openbel/api/routes/nanopubs.rb', line 20

def initialize(app)
  super

  bel_version = OpenBEL::Settings[:bel][:version]
  @spec       = BELParser::Language.specification(bel_version)

  mongo = OpenBEL::Settings[:nanopub_store][:mongo]
  @api  = OpenBEL::Nanopub::Nanopub.new(mongo)

  # RdfRepository using Jena.
  tdb = OpenBEL::Settings[:resource_rdf][:jena][:tdb_directory]
  @rr = BEL::RdfRepository.plugins[:jena].create_repository(:tdb_directory => tdb)

  # Annotations and Namespaces using RdfRepository
  @annotations                   = BEL::Resource::Annotations.new(@rr)
  @namespaces                    = BEL::Resource::Namespaces.new(@rr)
  @annotation_transform          = AnnotationTransform.new(@annotations)
  @annotation_grouping_transform = AnnotationGroupingTransform.new
  @default_references            = {
    :annotations => @annotations.each.map { |an|
      prefix = an.prefix.first.capitalize

      {
        :keyword => prefix,
        :type    => :uri,
        :domain  => an.uri.to_s
      }
    },
    :namespaces  => @namespaces.each.map  { |ns|
      prefix = ns.prefix.first.upcase

      {
        :keyword => prefix,
        :type    => :uri,
        :domain  => ns.uri.to_s
      }
    }
  }

  @supported_namespaces = Hash[
    @namespaces.each.map { |ns|
      prefix = ns.prefix.first.upcase

      [
        prefix,
        BELParser::Expression::Model::Namespace.new(
          prefix,
          ns.uri
        )
      ]
    }
  ]
end