Virtual Appliance FAQ

From NCBO Wiki
Jump to navigation Jump to search

Ontology Management

How do I identify version numbers for ontologies stored in the system?

NCBO Ontology Web Services can be used with either the ontology identifier (sometimes referred to as the virtual identifier) or the ontology version identifier (sometimes referred to as the version id). The ontology identifier is used to identify and ontology and all of its versions. The ontology version identifier represents a single ontology version. The following screenshot shows how to identify these version numbers using the BioPortal Web UI.

How do I add or change categories?

  1. Download the Protégé client (Version Protégé 3.4.4)
  2. Download the MySQL connector jar here. You will need to rename this file to 'driver.jar' and place it in the Protégé installation directory.
  3. Download a copy of the BioPortal Metadata Protégé project file and modify as follows
    1. Line 639: make sure this matches your BioPortal Ontology Services database (ip address or domain of the virtual appliance)
    2. Line 649: this should be your MySQL username (bp_protege)
    3. Line 654: this should be your MySQL password (bioportalprotege)
    4. Note: These are the default username/password which should be changed for security purposes. If you have already changed them, please use the new username/password.
  4. Open the project file using Protégé
  5. Go to the "Individuals" tab
  6. Look for OMV:OntologyDomain and click it
  7. A list of "Asserted Instances" should show up, these are the defaults
  8. You can create or delete instances by clicking on the buttons
  9. Instances should have the following properties:
    1. id = unique integer value
    2. omv:name = display name for the category
    3. omv:isSubDomainOf = you can create hierarchies by making categories subDomains of one another

How can I migrate ontologies from BioPortal or previous NCBO Virtual Appliance versions into a new Appliance?

NCBO developers have created a script that can be used to automatically import ontologies from BioPortal or previous versions of the Virtual Appliance. The script was written in Ruby and is included on the Appliance. To use the script, do the following (requires knowledge of Linux command-line tools):

  • Edit the script, located here: /var/rails/BioPortal/current/util/import_ontologies/import_ontologies.rb
    • Make sure you have valid API keys for the FROM and TO systems.
    • Assign the $FROM and $TO variables and ports as appropriate. The default configuration points to NCBO's BioPortal but can be changed to the location of your Virtual Appliance instance.
    • The $ONTOLOGY_OWNER is the user id of the user who should own the ontologies on the TO system.
    • $INCLUDE_ONTOLOGIES can be uncommented and used to import specific ontologies only. Otherwise all ontologies from the FROM system will be imported.
    • Save your edits and continue below.
  • Run the script using this command: sh /var/rails/BioPortal/current/util/import_ontologies/import_ontologies.rb
  • The script will take some time to complete, updating the console as it runs. If automatic parsing is enabled, the ontologies should get parsed when the process next runs.

Please Note: The import script will attempt to use category and group IDs assigned to ontologies on the FROM system if they exist on the TO system as well. Ontology artifacts, such as notes, views, and mappings, are not imported. Only the most recent version of ontologies are imported; there is no method to import multiple versions of the same ontology using a common virtual id.

Ontology Parsing

When are new ontologies parsed?

The BioPortal Ontology Services application uses a scheduler to run a process that collects newly submitted ontologies and parses them, adds them to the search index, and calculates metrics. You can also parse ontologies manually, but you will need to index them for search and calculate metrics manually to have that information available.

The default schedule can be disabled by doing the following:

  • Open /ncbo/sources/bioportal/tags/1030/
  • Look for the section that starts with "# Ontology Parse Scheduler properties"
  • Set ontology.parse.scheduler.enabled to 'false'
  • From the /ncbo/sources/bioportal/tags/1030/ directory, run 'ant clean deploywar'

How do I manually parse an ontology?

To manually parse an ontology, visit the admin interface at http://example:8080/bioportal_admin and select "Parse Ontologies" from the list at the right. You must enter the version id, or a comma-separated list of ids, and then click "Run". The process will return with errors if it encounters any.

How do I manually add an ontology to the search index?

To manually add an ontology to the search index, go to the admin interface and select "Index Ontologies". You can provide a single version id for an ontology or a comma-separated list of ids. You can also choose to index all ontologies currently stored in the Appliance (this may take some time if you have many terms in the system).

How do I know if an ontology has parsed?

Because the BioPortal Web UI uses aggressive caching, it may not immediately reflect the status of an ontology once it's been submitted. By default the ontology status on the Web UI is updated once every four or 12 hours (depending where you are viewing the information). You can change these default options by doing the following:

  • Open /var/rails/BioPortal/current/app/models/data_access.rb
  • Change the following in the getOntologyList method:
    • return self.cache_pull("ont_list", "getOntologyList", nil, MEDIUM_CACHE_EXPIRE_TIME)
    • return self.cache_pull("ont_list", "getOntologyList", nil, 60*15)
  • Change the following in the getOntology method:
    • return self.cache_pull("#{ontology_id}::_details", "getOntology", { :ontology_id => ontology_id })
    • return self.cache_pull("#{ontology_id}::_details", "getOntology", { :ontology_id => ontology_id }, 60*15)
  • This will change the Web UI so that it refreshed information about ontologies every 15 minutes
  • You will need to run /sbin/service httpd restart to have the change take affect
  • NOTE: You will need to make this change again if you update the Web UI code. In addition, if you have a large list of ontologies this could slow down the Web UI for users as it will be required to retrieve more information more often.

In addition, you can look at the REST service directly, which will always give you the most updated information. To do this, visit the following URL:

Is there a log file for parsing?

Parsing progress is logged in the BioPortal Ontology Services log files.

There is a separate log file for OBO ontologies that can be monitored: tail -f /var/log/tomcat6/lexgrid/LexBIG_load_log.txt

OWL and Protege-based ontologies are logged into the general log file: tail -f /var/log/tomcat6/bioportal.log

How can I manually remove the hierarchy information from an ontology like NCI Metathesaurus?

  • Find the database prefix of the ontology by looking up the ontology in the LexEVS registry.xml file.
  • Connect to the database that stores the LexEVS tables.
  • Find the set of tables that stores the ontology using the table prefix.
  • The table called codingSchemeSupportedAttrib needs to be updated to disable the hierarchy. To do so, find the row that has the column supportedAttributeTab that has a value called Hierarchy. Update that column to value HierarchyDisabled so that the loaded hierarchy is ignored.
  • Restart Tomcat so that the new values are read in and the cache gets cleared.

Systems Administration

How do I increase the Java heap size that Tomcat uses?

  • By default we use a 512MB initial heap with a 2GB maximum. You can change these values by editing this file:
    • /usr/local/tomcat6/conf/tomcat6.conf
  • Change the following line to match your requirements. -Xms is initial size, -Xmx is maximum size.
    • JAVA_OPTS="${DEBUG} -Xms512m -Xmx2G -Djava.awt.headless=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m"
  • Restart Tomcat by running the following command:
    • /sbin/service tomcat6 restart

Web User Interface

How can I clear the memcached-based UI cache?

  • If you are logged in as the admin user, simply visit http://example/admin and click the "Flush Memcache" button. There should be a response indicating success or failure.

How can I use widgets with my Virtual Appliance?

Working with Javascript-based widgets (Form Autocomplete, Quick Jump/Jump To)

In addition to the existing instructions, you must define an additional Javascript variable in order to have the widgets communicate with your instance of the Virtual Appliance.

 var BP_SEARCH_SERVER = "http://{your_appliance_ip_or_domain_name}";

Replace the '{your_appliance_ip_or_domain_name}' text with the IP address or domain name that's assigned to your Virtual Appliance.

Working with Flex/Flash-based widgets (FlexViz, Ontology Tree Widget)

When working with Flash widgets, you'll need to modify the existing instructions to change and add your ip address or domain name. See below and look for '{your_appliance_ip_or_domain_name}' and '{ontology_id}'. The '{ontology_id}' is the numerical id for the ontology you want to use with the widget, sometimes called a virtual id. You can find this via the REST service by looking for the <ontologyId> element, or looking in the Web UI on the Browse page. The links for ontologies contain a number that should be the virtual id.

This example is for the Tree Browser.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  id="OntologyTree" width="300" height="100%"
  <param name="movie" value="http://{your_appliance_ip_or_domain_name}/flex/OntologyTree.swf" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#ffffff" />
  <param name="allowScriptAccess" value="always" />
  <param name="flashVars" value="ontology=<%= @ontology.ontologyId%>&alerterrors=false&canchangeontology=false&virtual=true&server=http://{your_appliance_ip_or_domain_name}:8080/bioportal" />
  <embed src="http://{your_appliance_ip_or_domain_name}/flex/OntologyTree.swf" quality="high" bgcolor="#ffffff"
    width="300" height="100%" name="OntologyTree" align="middle"

In addition, there is a bug in existing versions of the Virtual Appliance that is scheduled to be fixed for the .5 version release in March 2012. Until then, you will need to run the following SQL commands to insert records into the 'bioportal' database:

INSERT INTO `ncbo_user` (`id`, `username`, `api_key`, `open_id`, `password`, `email`, `firstname`, `lastname`, `phone`, `date_created`)
	(39108, 'annotator_flex', X'32626535656235352D383665622D343164362D386238312D653238653532356163633063', NULL, '8qQ8v8cjUZBCs99voQ2+i4mR1VhyFuj70ZCQUV9caXrPQv4K9FuDIfsfrn+ICoXp\r\n', '', X'', X'', NULL, '2011-06-28 12:09:32'),
	(39109, 'search_flex', X'39626437366335382D323230642D346337662D386164302D306135363731313634313939', NULL, '/jj4oWOmI1SXbfczyReBZI9z4DSzRoZP/iX9WJe9lb/7vm1owez/yAh6lIRpNOyj\r\n', '', X'', X'', NULL, '2011-06-28 12:10:18'),
	(39110, 'recommender_flex', X'35636564383837322D646636342D343838372D613338652D376338653736333935633830', NULL, 'RBmX8e1X2oUEEcqdp73/X7P7JkrfA7lbK8+svGPEojYmcmxDoHui3gC011Pg1cRF\r\n', '', X'', X'', NULL, '2011-06-28 12:11:16'),
	(39111, 'flexviz', X'34363832396130352D386331632D343232622D393530642D313836373633616530663763', NULL, 'uivHblEQJII216fGfG0No4RGELzBtY7Bo14IQulDsQOJY4cLUItYuTtU+TkPs1ln\r\n', '', X'', X'', NULL, '2011-06-28 12:13:18');

How can I use the OVF image with my virtualization software?
(VMware, VirtualBox, KVM, Xen, etc)


You can use VMware's ovftool to convert the appliance to work with your VMware product. For example, to convert the appliance for use in VMware Player or Workstation, you would run the command:

ovftool ncbo-appliance.ovf ncbo-appliance.vmx


VirtualBox supports importing OVF images directly. Simply start your VirtualBox software, then select File->Import Appliance and select the OVF file included in the NCBO Virtual Appliance download.


First, convert the OVF to VMX format as mentioned in the VMware section above.

Next, ensure that the kvm-qemu-img RPM (or qemu-kvm DEB) is installed. Then, convert the [new] VMDKs (from the VMX conversion step) to raw disk images via the following command:

for disk in `ls -1 *.vmdk`; do diskbase=`basename $disk .vmdk`; qemu-img convert -O raw ${diskbase}.vmdk ${diskbase}.img; done

Create /etc/libvirt/qemu/ncbo-appliance.xml with the following contents:

<domain type='kvm'>
    <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
    <boot dev='hd'/>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/ncbo-appliance/ncbo-appliance-disk1.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/ncbo-appliance/ncbo-appliance-disk2.img'/>
      <target dev='hdb' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='1'/>
    <controller type='ide' index='0'/>
    <interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
    <serial type='pty'>
      <target port='0'/>
    <console type='pty'>
      <target port='0'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
      <model type='cirrus' vram='9216' heads='1'/>

Finally, make any necessary edits to the above file, and run:

virsh start ncbo-appliance


First, convert the VMDKs to raw disk images as mentioned in the KVM section above.

Create /etc/xen/ncbo-appliance.cfg with the following contents:

name = "ncbo-appliance"
memory = 4096
vcpus = 2
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "c"
pae = 1
acpi = 1
apic = 1
localtime = 0
on_poweroff = "destroy"
on_reboot = "destroy"
on_crash = "destroy"
device_model = "/usr/lib64/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
keymap = "en-us"
disk = [ "file:/var/lib/xen/images/ncbo-appliance/ncbo-appliance-disk1.img,hda,w", "file:/var/lib/xen/images/ncbo-appliance/ncbo-appliance-disk2.img,hdb,w" ]
vif = [ "bridge=xenbr0,script=vif-bridge,vifname=vif41.0" ]
parallel = "none"
serial = "pty"

Finally, make any necessary edits to the above file, and run:

xm create ncbo-appliance

How can I use the Appliance on Amazon EC2?

NCBO Bioportal appliance can be deployed in Amazon EC2. AMI is available in US West (Northern California) region.
ami-5187dd14 is build on EBS-backed 64-bit Amazon Linux AMI 2012.03

Detail Instructions:

  • Login to AWS Console.
  • Select EC2 Tab
  • Select US West (N. California) Region under Navigation.
  • Click on Instances → Launch Instance → Classic Wizard → Comunity AMIs → Choose an AMI:
  • AMI ID = ami-5187dd14 (or just search for “NCBO-Appliance-06”)
  • Click Continue
  • Proceed to Instance Details:
  • Instance Type = m1.large (or any other type with at least 2 cores and ~8 GB of RAM)
  • Availability Zone = No preference
  • Termination Protection = Prevention against accidental termination
  • Shutdown Behavior = Stop
  • Name = Name this instance something meaningful
  • Click Continue
  • Create Key Pair
    • Choose from your Exisitng Key Pairs or Create a Key Pair
  • Configure Firewall:
    • Choose (you may need to create one first) a Security Group that has ports 22, 80, and 8080 open. It is recommended that you only allow the networks you need. We accept no responsibility/liability for machines getting compromised.
  • Click Continue
  • Review:
  • Click Launch
  • Click on Instances:
  • Once the instance State has changed from Pending to Running and Status Checks is “2/2 checks passed”, login to the instance via the public hostname provided.
    • SSH into the machine using your key-pair and ec2-user user name.
 ssh -i yourkey_pair ec2-user@<amazon public dns name>