Skip to content

agroportal/ontologies_api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3,916 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ontologies_api

ontologies_api provides a RESTful interface for accessing BioPortal (an open repository of biomedical ontologies). Supported services include downloads, search, access to terms and concepts, text annotation, and much more.

Run ontologies_api

Using OntoPortal api utilities script

See help

bin/ontoportal help
Usage:
  ./bin/ontoportal <command> [options]
Commands:
  dev       Start the OntoPortal API development server.
            Examples:
              ./bin/ontoportal dev [shotgun|rackup]
              ./bin/ontoportal dev --api-url http://localhost:9393
              ./bin/ontoportal dev --reset-cache
              ./bin/ontoportal dev --provision-user-only
              ./bin/ontoportal dev --provision-ontology
              ./bin/ontoportal dev --linked-data-path ONTOLOGIES_LINKED_DATA_PATH
              ./bin/ontoportal dev --goo-path GOO_PATH
              ./bin/ontoportal dev  --sparql-client-path SPARQL_CLIENT_PATH

  test      Run tests (all or a specific file).
            Examples:
              ./bin/ontoportal test all
              ./bin/ontoportal test test/controllers/test_users_controller.rb --name=name_of_the_test
            Options:
              --name=TEST_NAME          Run only the test with the given name.
              --backend [vo|fs|ag|gb]   Run the test with specific backend type


  run       Run a command inside the OntoPortal API Docker container.
  help      Show this help message.

Arguments:
  [shotgun|rackup]          Specify the server that used in the dev env (default: shotgun)

Options (dev, test, run):
  --api-url URL             Set the API URL (default: http://localhost:9393).
  --reset-cache             Remove Docker volumes (use with 'dev').
  --provision-user-only     Create only the admin user (no ontology parsing).
  --provision-ontology      Create admin user and parse ontology for use.
  --linked-data-path PATH   Path for ontologies_linked_data.
  --goo-path PATH           Path for goo.
  --sparql-client-path PATH Path for sparql-client.

Notes:
  - 'dev' is for local development with Docker Compose.
  - 'test' supports both individual test files and the 'all' shortcut.
  - 'run' lets you execute arbitrary commands inside the container.

Run dev

bin/ontoportal dev 
bin/ontoportal dev [shotgun|rackup]
bin/ontoportal dev --api-url http://localhost:9393
bin/ontoportal dev --reset-cache
bin/ontoportal dev --provision-user-only
bin/ontoportal dev --provision-ontology
bin/ontoportal dev --linked-data-path ONTOLOGIES_LINKED_DATA_PATH
bin/ontoportal dev --goo-path GOO_PATH
bin/ontoportal dev  --sparql-client-path SPARQL_CLIENT_PATH

Run test with a local OntoPortal API

bin/ontoportal test all # Run all tests
bin/ontoportal test <path_to_the_test_file> # Run all tests in the test file
bin/ontoportal test <path_to_the_test_file> --name=name_of_the_test # Run single test in the test file
bin/ontoportal test all --backend ag # You can specify the backend type to use for tests

Manually

Prerequisites

  • Ruby 2.x (most recent patch level)
  • rbenv and ruby-build (optional)
    • If you need to switch Ruby versions for other projects, you may want to install something like rbenv to manage your Ruby environment.
  • Git
  • Bundler
    • Install with gem install bundler if you don't have it
    • To use local ontologies_linked_data gem: bundle config local.ontologies_linked_data ~/path_to/ontologies_linked_data/
  • 4store
    • NCBO code relies on 4store as the main datastore. There are several installation options, but the easiest is getting the binaries.
    • For starting, stopping, and restarting 4store easily, you can try setting up 4s-service
  • Redis
    • Used for caching (HTTP, query caching, Annotator cache)
  • Solr
    • BioPortal indexes ontology class and property content using Solr (a Lucene-based server)

Configuring Solr

To configure Solr for ontologies_api usage, modify the example project included with Solr by doing the following:

cd $SOLR_HOME
cp example ncbo
cd $SOLR_HOME/ncbo/solr
mv collection1 core1
cd $SOLR_HOME/ncbo/solr/core1/conf
# Copy NCBO-specific configuration files
cp `bundle show ontologies_linked_data`/config/solr/solrconfig.xml ./
cp `bundle show ontologies_linked_data`/config/solr/schema.xml ./
cd $SOLR_HOME/ncbo/solr
cp -R core1 core2
cp `bundle show ontologies_linked_data`/config/solr/solr.xml ./
# Edit $SOLR_HOME/ncbo/solr/solr.xml
# Find the following lines:
# <core name="NCBO1" config="solrconfig.xml" instanceDir="core1" schema="schema.xml" dataDir="data"/>
# <core name="NCBO2" config="solrconfig.xml" instanceDir="core2" schema="schema.xml" dataDir="data"/>
# Replace the value of `dataDir` in each line with: 
# /<your own path to data dir>/core1
# /<your own path to data dir>/core2
# Start solr
java -Dsolr.solr.home=solr -jar start.jar
# Edit the ontologieS_api/config/environments/{env}.rb file to point to your running instance:
# http://localhost:8983/solr/NCBO1

Installing

Clone the repository

$ git clone git@github.com:ncbo/ontologies_api.git
$ cd ontologies_api

Install the dependencies

$ bundle install

Create an environment configuration file

$ cp config/environments/config.rb.sample config/environments/development.rb

config.rb.sample can be copied and renamed to match whatever environment you're running, e.g.:

production.rb
development.rb
test.rb

Run the unit tests (optional)

Requires a configuration file for the test environment:

$ cp config/environments/config.rb.sample config/environments/test.rb

Execute the suite of tests from the command line:

$ bundle exec rake test 

Run the application

$ bundle exec rackup --port 9393 

Once started, the application will be available at localhost:9393.

Contributing

We encourage contributions! Please check out the contributing guide for guidelines on how to proceed.

Acknowledgements

The National Center for Biomedical Ontology is one of the National Centers for Biomedical Computing supported by the NHGRI, the NHLBI, and the NIH Common Fund under grant U54-HG004028.

License

LICENSE.md

Packages

 
 
 

Languages

  • Ruby 96.6%
  • Shell 2.0%
  • Other 1.4%