text:
module Checkpage.Options (
      defaultConfig
) where

import Checkpage.Types (Config (..))

-- | Default program configuration.
defaultConfig :: Config
defaultConfig = Config {
      loginURL = Nothing
    , configFile = Just "~/.checkpagerc"
    }

redpajama_set_name: RedPajamaGithub


text:
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include('shared.lua')
include("ai_translations.lua")


text:
package org.springframework.boot.autoconfigure.security.servlet;

import javax.servlet.http.HttpServletRequest;

import org.assertj.core.api.AssertDelegateTarget;
import org.junit.Test;

import org.springframework.boot.autoconfigure.h2.H2ConsoleProperties;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.StaticWebApplicationContext;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for {@link PathRequest}.
 *
 * @author Madhura Bhave
 */
public class PathRequestTests {

	@Test
	public void toStaticResourcesShouldReturnStaticResourceRequest() {
		assertThat(PathRequest.toStaticResources())
				.isInstanceOf(StaticResourceRequest.class);
	}

	@Test
	public void toH2ConsoleShouldMatchH2ConsolePath() {
		RequestMatcher matcher = PathRequest.toH2Console();
		assertMatcher(matcher).matches("/h2-console");
		assertMatcher(matcher).matches("/h2-console/subpath");
		assertMatcher(matcher).doesNotMatch("/js/file.js");
	}

	private RequestMatcherAssert assertMatcher(RequestMatcher matcher) {
		StaticWebApplicationContext context = new StaticWebApplicationContext();
		context.registerBean(ServerProperties.class);
		context.registerBean(H2ConsoleProperties.class);
		return assertThat(new RequestMatcherAssert(context, matcher));
	}

	private static class RequestMatcherAssert implements AssertDelegateTarget {

		private final WebApplicationContext context;

		private final RequestMatcher matcher;

		RequestMatcherAssert(WebApplicationContext context, RequestMatcher matcher) {
			this.context = context;
			this.matcher = matcher;
		}

		public void matches(String path) {
			matches(mockRequest(path));
		}

		private void matches(HttpServletRequest request) {
			assertThat(this.matcher.matches(request))
					.as("Matches " + getRequestPath(request)).isTrue();
		}

		public void doesNotMatch(String path) {
			doesNotMatch(mockRequest(path));
		}

		private void doesNotMatch(HttpServletRequest request) {
			assertThat(this.matcher.matches(request))
					.as("Does not match " + getRequestPath(request)).isFalse();
		}

		private MockHttpServletRequest mockRequest(String path) {
			MockServletContext servletContext = new MockServletContext();
			servletContext.setAttribute(
					WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
					this.context);
			MockHttpServletRequest request = new MockHttpServletRequest(servletContext);
			request.setPathInfo(path);
			return request;
		}

		private String getRequestPath(HttpServletRequest request) {
			String url = request.getServletPath();
			if (request.getPathInfo() != null) {
				url += request.getPathInfo();
			}
			return url;
		}

	}

}


text:
FROM golang:1.16.2

ENV GODEL_VERSION 2.36.0
ENV GODEL_CHECKSUM 91137f4fb9e1b4491d6dd821edf6ed39eb66f21410bf645a062f687049c45492

ENV PROJECT_PATH github.com/nmiyake/echgo2

ENV GIT_USERNAME "Tutorial User"
ENV GIT_EMAIL "tutorial@tutorial-user.com"

RUN apt-get update && apt-get install -y tree

# Set up Git author parameters and create initial repository directory
RUN git config --global user.name "${GIT_USERNAME}" && \
    git config --global user.email "${GIT_EMAIL}" && \
    mkdir -p ${GOPATH}/src/${PROJECT_PATH}

WORKDIR /go/src/${PROJECT_PATH}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Bidaud, Moënne-Loccoz, Reumaux, Carteret & Eyssartier, Atlas des Cortinaires (Meyzieu) 11: 613 (2001)

#### Original name
Cortinarius leonicolor Reumaux

### Remarks
null


text:
April Showers
4/01/14 4:15PM -0700
rain, more rain, some tag

Bring May flowers? I guess so.

![Reflection](/images/2014/04/reflection.jpg)


text:
require 'spec_helper'

describe Immature::PHRASES do
  it 'contains essential immaturities' do
    expect(subject).to include('in bed')
    expect(subject).to include('in your pants')
  end
end


text:
This is a Binary Search Problem. But what is different from the ordinary binary search is that
not the total array is sorted since the array is rotated. The way to deal with this like the
the question before:

```
1) everytime check if targe == nums[mid], if so, we find it.
2) otherwise, we check if the first half is in order (i.e. nums[left]<=nums[mid])
  and if so, go to step 3), otherwise, the second half is in order,   go to step 4)
3) check if target in the range of [left, mid-1] (i.e. nums[left]<=target < nums[mid]), if so, do search in the first half, i.e. right = mid-1; otherwise, search in the second half left = mid+1;
4)  check if target in the range of [mid+1, right] (i.e. nums[mid]<target <= nums[right]), if so, do search in the second half, i.e. left = mid+1; otherwise search in the first half right = mid-1;
```


text:
MYCALLPATHNAME=$0
MYCALLNAME=`basename $MYCALLPATHNAME`
MYCALLNAME=${MYCALLNAME%.sh}
MYCALLPATH=`dirname $MYCALLPATHNAME`g

MYBOOTSTRAPFILE=$(getPathToBootstrapDir.sh)/bootstrap-03_03_001.sh
. ${MYBOOTSTRAPFILE}
if [ $? -ne 0 ];then
	echo "ERROR:Missing bootstrap file:configuration: ${MYBOOTSTRAPFILE}">&2
	exit 1
fi
setUTALMbash 1 $*
#
###
#
. $(getPathToLib.sh libutalmfileobjects.sh)
PATH0=$(setUpperTreeSearchPath . tests)
TROOT=$(getUpperTreePathMatch $PWD tests 0)
. $(getPathToLib.sh libutalmrefpersistency.sh)
refDataInit $TROOT
dataX="${PATH0//$TROOT\//}"

refDataStore ID000 $dataX

export dataX
{
	(
		TESTMODE=$T_CREATEREF  assertRefDataWithExit $LINENO $BASH_SOURCE ID001 "$dataX";
	);
	(
		TESTMODE=$T_COMPAREREF assertRefDataWithExit $LINENO $BASH_SOURCE ID001 "$dataX";
	);
	refx=$(TESTMODE=$((T_COMPAREREF|T_PRINTASSERT)) assertRefDataWithExit $LINENO $BASH_SOURCE ID001 "$dataX" 2>&1|sed '/utalm_exit:0/d')
	assertWithExit $LINENO $BASH_SOURCE "[[ \"$refx\" == \"[[ '$dataX' == '$dataX' ]]\" ]]";
} 2>&1 |countErrors flat=1 filter=1 sums=1 intermediate=0

## \endcond


text:
class TestController

  attr_reader :controller_name, :action_name, :params

  def initialize(controller_name, action_name, params)
    @controller_name = controller_name
    @action_name = action_name
    @params = params
  end

  def current_user
    @current_user
  end

  def current_user=(user)
    @current_user = user
  end

  def other_user
    @other_user
  end

  def other_user=(user)
    @other_user = user
  end

end


text:
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at

#      http://www.apache.org/licenses/LICENSE-2.0

#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

module Mobiles
  # Use this class to retrieve a mobile class for a particular user-agent or
  # based on the device name.
  # This class uses a build in cache mechanism to improve the performance

  class DeviceLocator

    @@mobiles_map = Hash.new
    @@devices_cache = Hash.new

    # used for internal use. Unfortunately we can't declare it as a private method
    def self.eval_file filename
      abs_filename = File.dirname(__FILE__)+'/../../repo/'+filename
      eval(File.new(abs_filename).read)
    end

    eval_file 'device_map.rbx'

    # returns an instance of a device class for the provided user-agent parameter
    def self.find_device_by_user_agent user_agent
      device_id = @@mobiles_map.fetch(user_agent , nil)
        unless device_id.nil?
          find_device_by_device_id device_id

        end
    end

    # returns an instance of a device class for the provided device_id parameter
    def self.find_device_by_device_id device_id
      device = @@devices_cache.fetch(device_id , nil)
       if device.nil?
             class_name = class_name_for_device_id device_id
          device = eval  <<-command
                          eval_file '#{device_id}.rbx'
                          Mobiles::Repository::#{class_name}.new
                        command
          @@devices_cache.update({device_id => device})
          end
          device
    end
    private
    def self.class_name_for_device_id device_id
      class_name = device_id
      if device_id.match(/^d/)
        class_name = "m"+device_id
      end
      class_name.capitalize

    end
  end
end


text:
import PythonQt
from PythonQt import QtCore, QtGui
import director.visualization as vis

class ViewEventFilter(object):

    LEFT_DOUBLE_CLICK_EVENT = 'LEFT_DOUBLE_CLICK_EVENT'

    def __init__(self, view):
        self.view = view
        self._leftMouseStart = None
        self._rightMouseStart = None
        self._handlers = {}
        self.installEventFilter()

    def installEventFilter(self):
        self.eventFilter = PythonQt.dd.ddPythonEventFilter()
        self.eventFilter.connect('handleEvent(QObject*, QEvent*)', self.filterEvent)
        self.view.vtkWidget().installEventFilter(self.eventFilter)
        for eventType in self.getFilteredEvents():
            self.eventFilter.addFilteredEventType(eventType)

    def removeEventFilter(self):
        self.view.vtkWidget().removeEventFilter(self.eventFilter)
        self.eventFilter.disconnect('handleEvent(QObject*, QEvent*)', self.filterEvent)

    def getFilteredEvents(self):
        return [QtCore.QEvent.MouseButtonDblClick,
                QtCore.QEvent.MouseButtonPress,
                QtCore.QEvent.MouseButtonRelease,
                QtCore.QEvent.MouseMove,
                QtCore.QEvent.Wheel,
                QtCore.QEvent.KeyPress,
                QtCore.QEvent.KeyRelease]

    def addHandler(self, eventType, handler):
        self._handlers.setdefault(eventType, []).append(handler)

    def callHandler(self, eventType, *args, **kwargs):
        for handler in self._handlers.get(eventType, []):
            if handler(*args, **kwargs):
                self.consumeEvent()
                break

    def getMousePositionInView(self, event):
        return vis.mapMousePosition(self.view, event)

    def getCursorDisplayPosition(self):
        cursorPos = self.view.mapFromGlobal(QtGui.QCursor.pos())
        return cursorPos.x(), self.view.height - cursorPos.y()

    def consumeEvent(self):
        self.eventFilter.setEventHandlerResult(True)

    def filterEvent(self, obj, event):

        if event.type() == QtCore.QEvent.MouseButtonDblClick and event.button() == QtCore.Qt.LeftButton:
            self.onLeftDoubleClick(event)

        elif event.type() == QtCore.QEvent.MouseButtonPress and event.button() == QtCore.Qt.LeftButton:
            self._leftMouseStart = QtCore.QPoint(event.pos())
            self.onLeftMousePress(event)

        elif event.type() == QtCore.QEvent.MouseButtonPress and event.button() == QtCore.Qt.RightButton:
            self._rightMouseStart = QtCore.QPoint(event.pos())

        elif event.type() == QtCore.QEvent.MouseMove:

            if self._rightMouseStart is None and self._leftMouseStart is None:
                self.onMouseMove(event)

            else:
                if self._rightMouseStart is not None:
                    delta = QtCore.QPoint(event.pos()) - self._rightMouseStart
                    if delta.manhattanLength() > 3:
                        self._rightMouseStart = None

                if self._leftMouseStart is not None:
                    delta = QtCore.QPoint(event.pos()) - self._leftMouseStart
                    if delta.manhattanLength() > 3:
                        self._leftMouseStart = None

        elif event.type() == QtCore.QEvent.MouseButtonRelease and event.button() == QtCore.Qt.LeftButton and self._leftMouseStart is not None:
            self._leftMouseStart = None
            self.onLeftClick(event)

        elif event.type() == QtCore.QEvent.MouseButtonRelease and event.button() == QtCore.Qt.RightButton and self._rightMouseStart is not None:
            self._rightMouseStart = None
            self.onRightClick(event)

        elif event.type() == QtCore.QEvent.Wheel:
            self.onMouseWheel(event)

        elif event.type() == QtCore.QEvent.KeyPress:
            if not event.isAutoRepeat():
                self.onKeyPress(event)
            self.onKeyPressRepeat(event)

        elif event.type() == QtCore.QEvent.KeyRelease and not event.isAutoRepeat():
            self.onKeyRelease(event)

    def onMouseWheel(self, event):
        pass

    def onMouseMove(self, event):
        pass

    def onLeftMousePress(self, event):
        pass

    def onLeftDoubleClick(self, event):
        pass

    def onLeftClick(self, event):
        pass

    def onRightClick(self, event):
        pass

    def onKeyPress(self, event):
        pass

    def onKeyPressRepeat(self, event):
        pass

    def onKeyRelease(self, event):
        pass


text:
<?php
include('./lib/UIguard.php');

class UIguardTest extends PHPUnit_Framework_TestCase
{
    public function testHasPermission()
    {
        $permissionmatrix = array(
            'permission1' => array(
                'default' => FALSE,
                'test' => array(
                    'role' => array(
                        'admin',
                    ),
                ),
            ),
        );

        $uig = new sspmod_janus_UIguard($permissionmatrix);

        $this->assertTrue($uig->hasPermission('permission1', 'test', array('admin')));
    }
}


text:
package com.siyeh.ig.threading;

import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtil;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.psiutils.ParenthesesUtils;
import com.siyeh.ig.psiutils.TypeUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class SynchronizeOnThisInspection extends BaseInspection {

  @Override
  @NotNull
  protected String buildErrorString(Object... infos) {
    final boolean syncOnClass = ((Boolean)infos[0]).booleanValue();
    return InspectionGadgetsBundle.message(
      syncOnClass ? "synchronize.on.class.problem.descriptor" : "synchronize.on.this.problem.descriptor");
  }

  @Override
  public BaseInspectionVisitor buildVisitor() {
    return new SynchronizeOnThisVisitor();
  }

  private static class SynchronizeOnThisVisitor extends BaseInspectionVisitor {

    @Override
    public void visitSynchronizedStatement(@NotNull PsiSynchronizedStatement statement) {
      super.visitSynchronizedStatement(statement);
      final PsiExpression lockExpression = ParenthesesUtils.stripParentheses(statement.getLockExpression());
      if (lockExpression instanceof PsiThisExpression) {
        registerError(lockExpression, Boolean.FALSE);
      }
      else if (hasJavaLangClassType(lockExpression)) {
        registerError(lockExpression, Boolean.TRUE);
      }
    }

    @Override
    public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) {
      super.visitMethodCallExpression(expression);
      final PsiReferenceExpression methodExpression = expression.getMethodExpression();
      if (!ThreadingUtils.isNotifyOrNotifyAllCall(expression) && !ThreadingUtils.isWaitCall(expression)) {
        return;
      }
      final PsiExpression qualifier = ParenthesesUtils.stripParentheses(methodExpression.getQualifierExpression());
      if (qualifier == null || (qualifier instanceof PsiThisExpression)) {
        registerMethodCallError(expression, Boolean.FALSE);
      }
      else if (hasJavaLangClassType(qualifier)) {
        registerMethodCallError(expression, Boolean.TRUE);
      }
    }

    private static boolean hasJavaLangClassType(@Nullable PsiExpression expression) {
      if (expression == null) {
        return false;
      }
      final PsiType type = expression.getType();
      if (!(type instanceof PsiClassType)) {
        return false;
      }
      final PsiClassType classType = (PsiClassType)type;
      final PsiClassType javaLangClassType = TypeUtils.getType(CommonClassNames.JAVA_LANG_CLASS, expression);
      if (!javaLangClassType.isAssignableFrom(classType)) {
        return false;
      }
      final PsiType[] parameters = classType.getParameters();
      if (parameters.length == 0) {
        return true;
      }
      if (parameters.length > 1) {
        return false;
      }
      final PsiType parameterType = parameters[0];
      if (isNonPrivateClassType(parameterType)) {
        return true;
      }
      if (!(parameterType instanceof PsiCapturedWildcardType)) {
        return false;
      }
      final PsiCapturedWildcardType capturedWildcardType = (PsiCapturedWildcardType)parameterType;
      final PsiWildcardType wildcardType = capturedWildcardType.getWildcard();
      final PsiType extendsBoundType = wildcardType.getExtendsBound();
      return isNonPrivateClassType(extendsBoundType);
    }

    private static boolean isNonPrivateClassType(PsiType type) {
      final PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(type);
      return aClass != null && !aClass.hasModifierProperty(PsiModifier.PRIVATE);
    }
  }
}


text:
package org.apache.drill.exec.store.ischema;

import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.schema.Schema;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.Table;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.planner.logical.DrillViewInfoProvider;
import org.apache.drill.exec.record.metadata.TupleMetadata;
import org.apache.drill.exec.server.options.OptionManager;
import org.apache.drill.exec.store.AbstractSchema;
import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory;
import org.apache.drill.exec.util.FileSystemUtil;
import org.apache.drill.metastore.MetastoreColumn;
import org.apache.drill.metastore.Metastore;
import org.apache.drill.metastore.components.tables.BasicTablesRequests;
import org.apache.drill.metastore.components.tables.BasicTablesTransformer;
import org.apache.drill.metastore.components.tables.TableMetadataUnit;
import org.apache.drill.metastore.expressions.FilterExpression;
import org.apache.drill.metastore.metadata.BaseTableMetadata;
import org.apache.drill.metastore.metadata.MetadataInfo;
import org.apache.drill.metastore.metadata.MetadataType;
import org.apache.drill.metastore.statistics.ColumnStatistics;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.slf4j.Logger;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import static org.apache.drill.exec.planner.types.DrillRelDataTypeSystem.DRILL_REL_DATATYPE_SYSTEM;
import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.IS_CATALOG_CONNECT;
import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.IS_CATALOG_DESCRIPTION;
import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.IS_CATALOG_NAME;
import static org.slf4j.LoggerFactory.getLogger;

/**
 * Provides methods to collect various information_schema data.
 */
public interface RecordCollector {

  /**
   * Collects catalogs data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of catalog records
   */
  List<Records.Catalog> catalogs(String schemaPath, SchemaPlus schema);

  /**
   * Collects schemas data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of schema records
   */
  List<Records.Schema> schemas(String schemaPath, SchemaPlus schema);

  /**
   * Collects tables data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of table records
   */
  List<Records.Table> tables(String schemaPath, SchemaPlus schema);

  /**
   * Collects views data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of view records
   */
  List<Records.View> views(String schemaPath, SchemaPlus schema);

  /**
   * Collects columns data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of column records
   */
  List<Records.Column> columns(String schemaPath, SchemaPlus schema);

  /**
   * Collects partitions data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of partition records
   */
  List<Records.Partition> partitions(String schemaPath, SchemaPlus schema);

  /**
   * Collects files data for information_schema.
   *
   * @param schemaPath schema name
   * @param schema schema instance
   * @return list of file records
   */
  List<Records.File> files(String schemaPath, SchemaPlus schema);

  /**
   * Provides information_schema data based on information stored in {@link AbstractSchema}.
   */
  class BasicRecordCollector implements RecordCollector {

    private static final String DEFAULT_OWNER = "<owner>";

    private final FilterEvaluator filterEvaluator;
    private final OptionManager optionManager;

    public BasicRecordCollector(FilterEvaluator filterEvaluator, OptionManager optionManager) {
      this.filterEvaluator = filterEvaluator;
      this.optionManager = optionManager;
    }

    @Override
    public List<Records.Catalog> catalogs(String schemaPath, SchemaPlus schema) {
      return Collections.singletonList(new Records.Catalog(IS_CATALOG_NAME, IS_CATALOG_DESCRIPTION, IS_CATALOG_CONNECT));
    }

    @Override
    public List<Records.Schema> schemas(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);

      return Collections.singletonList(new Records.Schema(IS_CATALOG_NAME, schemaPath,
        DEFAULT_OWNER, drillSchema.getTypeName(), drillSchema.isMutable()));
    }

    @Override
    public List<Records.Table> tables(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);

      return drillSchema.getTableNamesAndTypes().stream()
        .filter(entry -> filterEvaluator.shouldVisitTable(schemaPath, entry.getKey(), entry.getValue()))
        .map(entry -> new Records.Table(IS_CATALOG_NAME, schemaPath, entry.getKey(), entry.getValue().jdbcName))
        .collect(Collectors.toList());
    }

    @Override
    public List<Records.View> views(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);

      return drillSchema.getTablesByNames(schema.getTableNames()).stream()
        .filter(pair -> pair.getValue().getJdbcTableType() == Schema.TableType.VIEW)
        .filter(pair -> filterEvaluator.shouldVisitTable(schemaPath, pair.getKey(), pair.getValue().getJdbcTableType()))
        .map(pair -> new Records.View(IS_CATALOG_NAME, schemaPath, pair.getKey(),
          // View's SQL may not be available for some non-Drill views, for example, JDBC view
          pair.getValue() instanceof DrillViewInfoProvider ? ((DrillViewInfoProvider) pair.getValue()).getViewSql() : ""))
        .collect(Collectors.toList());
    }

    @Override
    public List<Records.Column> columns(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
      List<Records.Column> records = new ArrayList<>();
      for (Pair<String, ? extends Table> tableNameToTable : drillSchema.getTablesByNames(schema.getTableNames())) {
        String tableName = tableNameToTable.getKey();
        Table table = tableNameToTable.getValue();
        Schema.TableType tableType = table.getJdbcTableType();

        if (filterEvaluator.shouldVisitTable(schemaPath, tableName, tableType)) {
          RelDataType tableRow = table.getRowType(new JavaTypeFactoryImpl(DRILL_REL_DATATYPE_SYSTEM));
          for (RelDataTypeField field : tableRow.getFieldList()) {
            if (filterEvaluator.shouldVisitColumn(schemaPath, tableName, field.getName())) {
              records.add(new Records.Column(IS_CATALOG_NAME, schemaPath, tableName, field));
            }
          }
        }
      }
      return records;
    }

    @Override
    public List<Records.Partition> partitions(String schemaPath, SchemaPlus schema) {
      return Collections.emptyList();
    }

    @Override
    public List<Records.File> files(String schemaPath, SchemaPlus schema) {
      if (filterEvaluator.shouldVisitFiles(schemaPath, schema)) {
        try {
          AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
          if (drillSchema instanceof WorkspaceSchemaFactory.WorkspaceSchema) {
            WorkspaceSchemaFactory.WorkspaceSchema wsSchema = (WorkspaceSchemaFactory.WorkspaceSchema) drillSchema;
            String defaultLocation = wsSchema.getDefaultLocation();
            FileSystem fs = wsSchema.getFS();
            boolean recursive = optionManager.getBoolean(ExecConstants.LIST_FILES_RECURSIVELY);
            // add URI to the path to ensure that directory objects are skipped (see S3AFileSystem.listStatus method)
            return FileSystemUtil.listAllSafe(fs, new Path(fs.getUri().toString(), defaultLocation), recursive).stream()
              .map(fileStatus -> new Records.File(schemaPath, wsSchema, fileStatus))
              .collect(Collectors.toList());
          }
        } catch (ClassCastException | UnsupportedOperationException e) {
          // ignore the exception since either this is not a Drill schema or schema does not support files listing
        }
      }
      return Collections.emptyList();
    }
  }

  /**
   * Provides information_schema data based on information stored in Drill Metastore.
   */
  class MetastoreRecordCollector implements RecordCollector {

    private static final Logger logger = getLogger(MetastoreRecordCollector.class);

    public static final int UNDEFINED_INDEX = -1;

    private final Metastore metastore;
    private final FilterEvaluator filterEvaluator;

    public MetastoreRecordCollector(Metastore metastore, FilterEvaluator filterEvaluator) {
      this.metastore = metastore;
      this.filterEvaluator = filterEvaluator;
    }

    @Override
    public List<Records.Catalog> catalogs(String schemaPath, SchemaPlus schema) {
      return Collections.emptyList();
    }

    @Override
    public List<Records.Schema> schemas(String schemaPath, SchemaPlus schema) {
      return Collections.emptyList();
    }

    @Override
    public List<Records.Table> tables(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
      List<Records.Table> records = new ArrayList<>();
      List<BaseTableMetadata> baseTableMetadata;
      if (shouldVisitSchema(drillSchema)) {
        try {
          baseTableMetadata = metastore.tables().basicRequests()
            .tablesMetadata(FilterExpression.and(
              FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, drillSchema.getSchemaPath().get(0)),
              FilterExpression.equal(MetastoreColumn.WORKSPACE, drillSchema.getSchemaPath().get(1))));
        } catch (Exception e) {
          // ignore all exceptions related to Metastore data retrieval, return empty result
          logger.warn("Error while retrieving Metastore table data: {}", e.getMessage());
          logger.debug(e.getMessage(), e);
          return records;
        }

        baseTableMetadata.stream()
          .filter(table -> filterEvaluator.shouldVisitTable(schemaPath, table.getTableInfo().name(), Schema.TableType.TABLE))
          .map(table -> new Records.Table(IS_CATALOG_NAME, schemaPath, Schema.TableType.TABLE.toString(), table))
          .forEach(records::add);
      }
      return records;
    }

    @Override
    public List<Records.View> views(String schemaPath, SchemaPlus schema) {
      return Collections.emptyList();
    }

    @Override
    public List<Records.Column> columns(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
      List<Records.Column> records = new ArrayList<>();
      if (shouldVisitSchema(drillSchema)) {
        List<BaseTableMetadata> baseTableMetadata;
        try {
          baseTableMetadata = metastore.tables().basicRequests()
            .tablesMetadata(FilterExpression.and(
              FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, drillSchema.getSchemaPath().get(0)),
              FilterExpression.equal(MetastoreColumn.WORKSPACE, drillSchema.getSchemaPath().get(1)),
              // exclude tables without schema
              FilterExpression.isNotNull(MetastoreColumn.SCHEMA)));
        } catch (Exception e) {
          // ignore all exceptions related to Metastore data retrieval, return empty result
          logger.warn("Error while retrieving Metastore table data: {}", e.getMessage());
          logger.debug(e.getMessage(), e);
          return records;
        }

        baseTableMetadata.stream()
          .filter(table -> filterEvaluator.shouldVisitTable(schemaPath, table.getTableInfo().name(), Schema.TableType.TABLE))
          .map(table -> columns(schemaPath, table, table.getSchema(), null, UNDEFINED_INDEX, false))
          .forEach(records::addAll);
      }
      return records;
    }

    /**
     * Recursively scan given table schema and provides list of column records.
     * Recursion is used to scan map / struct columns which have nested columns.
     *
     * @param schemaPath schema name
     * @param table table instance
     * @param schema table or column schema
     * @param parentColumnNames list of parent column names if any
     * @param columnIndex column index if any
     * @param isNested indicates if column is nested
     * @return list of column records
     */
    private List<Records.Column> columns(String schemaPath,
                                         BaseTableMetadata table,
                                         TupleMetadata schema,
                                         List<String> parentColumnNames,
                                         int columnIndex,
                                         boolean isNested) {
      List<Records.Column> records = new ArrayList<>();
      schema.toMetadataList().forEach(
        column -> {
          List<String> columnNames = CollectionUtils.isEmpty(parentColumnNames) ? new ArrayList<>() : new ArrayList<>(parentColumnNames);
          columnNames.add(column.name());
          // nested columns have the same index as their parent
          int currentIndex = columnIndex == UNDEFINED_INDEX ? schema.index(column.name()) : columnIndex;
          // if column is a map / struct, recursively scan nested columns
          if (column.isMap()) {
            List<Records.Column> mapRecords =
              columns(schemaPath, table, column.tupleSchema(), columnNames, currentIndex, true);
            records.addAll(mapRecords);
          }

          String tableName = table.getTableInfo().name();

          // concat parent column names to use full column name, i.e. struct_col.nested_col
          String columnPath = String.join(".", columnNames);
          if (filterEvaluator.shouldVisitColumn(schemaPath, tableName, columnPath)) {
            ColumnStatistics<?> columnStatistics =
              table.getColumnStatistics(SchemaPath.getCompoundPath(columnNames.toArray(new String[0])));
            records.add(new Records.Column(IS_CATALOG_NAME, schemaPath, tableName, columnPath,
              column, columnStatistics, currentIndex, isNested));
          }
        });
      return records;
    }

    @Override
    public List<Records.Partition> partitions(String schemaPath, SchemaPlus schema) {
      AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
      List<Records.Partition> records = new ArrayList<>();
      if (shouldVisitSchema(drillSchema)) {

        BasicTablesTransformer.MetadataHolder metadataHolder;
        try {
          BasicTablesRequests.RequestMetadata requestMetadata = BasicTablesRequests.RequestMetadata.builder()
            .metadataTypes(MetadataType.SEGMENT, MetadataType.PARTITION)
            .customFilter(FilterExpression.and(
              FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, drillSchema.getSchemaPath().get(0)),
              FilterExpression.equal(MetastoreColumn.WORKSPACE, drillSchema.getSchemaPath().get(1)),
              // exclude DEFAULT_SEGMENT (used only for non-partitioned tables)
              FilterExpression.notEqual(MetastoreColumn.METADATA_KEY, MetadataInfo.DEFAULT_SEGMENT_KEY)))
            .build();

          List<TableMetadataUnit> units = metastore.tables().basicRequests().request(requestMetadata);

          metadataHolder = BasicTablesTransformer.all(units);
        } catch (Exception e) {
          // ignore all exceptions related to Metastore data retrieval, return empty result
          logger.warn("Error while retrieving Metastore segment / partition data: {}", e.getMessage());
          logger.debug(e.getMessage(), e);
          return records;
        }

        metadataHolder.segments().stream()
          .filter(segment -> filterEvaluator.shouldVisitTable(schemaPath, segment.getTableInfo().name(), Schema.TableType.TABLE))
          .filter(segmentMetadata -> Objects.nonNull(segmentMetadata.getPartitionValues()))
          .map(segment -> Records.Partition.fromSegment(IS_CATALOG_NAME, schemaPath, segment))
          .forEach(records::addAll);

        metadataHolder.partitions().stream()
          .filter(partition -> filterEvaluator.shouldVisitTable(schemaPath, partition.getTableInfo().name(), Schema.TableType.TABLE))
          .filter(partitionMetadata -> Objects.nonNull(partitionMetadata.getPartitionValues()))
          .map(partition -> Records.Partition.fromPartition(IS_CATALOG_NAME, schemaPath, partition))
          .forEach(records::addAll);
      }
      return records;
    }

    @Override
    public List<Records.File> files(String schemaPath, SchemaPlus schema) {
      return Collections.emptyList();
    }

    /**
     * Checks if given schema should be searched in Drill Metastore.
     * Schema must have to parent with corresponds to storage plugin and
     * actual name which corresponds to workspace name.
     *
     * @param schema schema instance
     * @return true if schema should be visited, false otherwise
     */
    private boolean shouldVisitSchema(AbstractSchema schema) {
      return schema.getSchemaPath().size() == 2;
    }
  }
}


text:
"""
Copyright 2018 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

class RunParams(object):
  """Run parameters for TCAV."""

  def __init__(self,
               bottleneck,
               concepts,
               target_class,
               activation_generator,
               cav_dir,
               alpha,
               model,
               overwrite=True):
    """A simple class to take care of TCAV parameters.

    Args:
      bottleneck: the name of a bottleneck of interest.
      concepts: one concept
      target_class: one target class
      activation_generator: an ActivationGeneratorInterface instance
      cav_dir: the path to store CAVs
      alpha: cav parameter.
      model: an instance of a model class.
      overwrite: if set True, rewrite any files written in the *_dir path
    """
    self.bottleneck = bottleneck
    self.concepts = concepts
    self.target_class = target_class
    self.activation_generator = activation_generator
    self.cav_dir = cav_dir
    self.alpha = alpha
    self.overwrite = overwrite
    self.model = model

  def get_key(self):
    return '_'.join([
        str(self.bottleneck), '_'.join(self.concepts),
        'target_' + self.target_class, 'alpha_' + str(self.alpha)
    ])


text:
<?php

// snippet-start:[ec2.php.create_key_pair.complete]
// snippet-start:[ec2.php.create_key_pair.import]

require 'vendor/autoload.php';

use Aws\Ec2\Ec2Client;
// snippet-end:[ec2.php.create_key_pair.import]
/**
 * Create a Key Pair
 *
 * This code expects that you have AWS credentials set up per:
 * https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html
 */

// snippet-start:[ec2.php.create_key_pair.main]
$ec2Client = new Aws\Ec2\Ec2Client([
    'region' => 'us-west-2',
    'version' => '2016-11-15',
    'profile' => 'default'
]);

$keyPairName = 'my-keypair';

$result = $ec2Client->createKeyPair(array(
    'KeyName' => $keyPairName
));

// Save the private key
$saveKeyLocation = getenv('HOME') . "/.ssh/{$keyPairName}.pem";
file_put_contents($saveKeyLocation, $result['keyMaterial']);

// Update the key's permissions so it can be used with SSH
chmod($saveKeyLocation, 0600);

// snippet-end:[ec2.php.create_key_pair.main]
// snippet-end:[ec2.php.create_key_pair.complete]
// snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourcedescription:[CreateKeyPair.php demonstrates how to create a 2048-bit RSA Amazon EC2 key pair.]
// snippet-keyword:[PHP]
// snippet-sourcesyntax:[php]
// snippet-keyword:[AWS SDK for PHP v3]
// snippet-keyword:[Code Sample]
// snippet-keyword:[Amazon EC2]
// snippet-service:[ec2]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[2018-09-20]
// snippet-sourceauthor:[jschwarzwalder (AWS)]


text:
package gov.va.oia.terminology.converters.umlsUtils;

import gov.va.oia.terminology.converters.sharedUtils.ConsoleUtil;
import gov.va.oia.terminology.converters.sharedUtils.ConverterBaseMojo;
import gov.va.oia.terminology.converters.sharedUtils.EConceptUtility;
import gov.va.oia.terminology.converters.sharedUtils.EConceptUtility.DescriptionType;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.BPT_Annotations;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.BPT_ContentVersion;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.BPT_Descriptions;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.BPT_MemberRefsets;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.BPT_Relations;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.ConceptCreationNotificationListener;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.Property;
import gov.va.oia.terminology.converters.sharedUtils.propertyTypes.PropertyType;
import gov.va.oia.terminology.converters.sharedUtils.stats.ConverterUUID;
import gov.va.oia.terminology.converters.umlsUtils.propertyTypes.PT_Refsets;
import gov.va.oia.terminology.converters.umlsUtils.propertyTypes.PT_Relationship_Metadata;
import gov.va.oia.terminology.converters.umlsUtils.propertyTypes.PT_SAB_Metadata;
import gov.va.oia.terminology.converters.umlsUtils.propertyTypes.PT_UMLS_Relationships;
import gov.va.oia.terminology.converters.umlsUtils.rrf.REL;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.maven.plugin.logging.Log;
import org.dwfa.cement.ArchitectonicAuxiliary;
import org.dwfa.util.id.Type3UuidFactory;
import org.ihtsdo.etypes.EConcept;
import org.ihtsdo.tk.dto.concept.component.TkComponent;
import org.ihtsdo.tk.dto.concept.component.refex.type_string.TkRefsetStrMember;
import org.ihtsdo.tk.dto.concept.component.refex.type_uuid.TkRefexUuidMember;
import org.ihtsdo.tk.dto.concept.component.relationship.TkRelationship;

public abstract class RRFBaseConverterMojo extends ConverterBaseMojo
{
	//Used for UMLS metadata, and all of RxNorm
	protected String namespaceSeed_;

	protected HashMap<String, String> terminologyCodeRefsetPropertyName_ = new HashMap<>();
	protected PropertyType ptUMLSAttributes_;
	protected HashMap<String, PropertyType> ptTermAttributes_ = new HashMap<>();
	protected PropertyType ptIds_;
	protected PT_Refsets ptUMLSRefsets_;
	protected HashMap<String, BPT_MemberRefsets> ptRefsets_ = new HashMap<>();
	protected BPT_ContentVersion ptContentVersion_;
	protected PropertyType ptSTypes_;
	protected PropertyType ptSuppress_;
	protected PropertyType ptLanguages_;
	protected PropertyType ptSourceRestrictionLevels_;
	protected PropertyType ptSABs_;
	protected PT_UMLS_Relationships ptUMLSRelationships_;
	protected HashMap<String, PropertyType> ptDescriptions_ = new HashMap<>();;
	protected HashMap<String, PropertyType> ptRelationshipGeneric_ = new HashMap<>();;
	protected HashMap<String, PropertyType> ptRelationshipSpecificTypes_ = new HashMap<>();;
	protected PropertyType ptRelationshipMetadata_;
	public HashMap<String, Relationship> nameToRel_ = new HashMap<>();
	protected HashMap<String, UUID> semanticTypes_ = new HashMap<>();
	protected EConceptUtility eConcepts_;
	protected DataOutputStream dos_;
	protected RRFDatabaseHandle db_;
	protected String tablePrefix_;
	//sabQueryString is only populated if they provided a filter list
	protected String sabQueryString_ = "";
	protected HashSet<String> sabsInDB_ = new HashSet<>();
	public boolean isRxNorm;

	private HashMap<String, UUID> rootConcepts_ = new HashMap<>();
	protected EConcept umlsRootConcept_ = null;

	protected UUID metaDataRoot_;

	PreparedStatement satRelStatement_;

	private HashSet<UUID> loadedRels_ = new HashSet<>();
	private HashSet<UUID> skippedRels_ = new HashSet<>();

	private HashMap<String, HashMap<String, HashMap<String, AtomicInteger>>> mappingRelCounters_ = new HashMap<>();
	private HashMap<String, AbbreviationExpansion> abbreviationExpansions;

	//disabled debug code
	//protected HashSet<UUID> conceptUUIDsUsedInRels_ = new HashSet<>();
	//protected HashSet<UUID> conceptUUIDsCreated_ = new HashSet<>();

	/**
	 * If sabList is null or empty, no sab filtering is done.
	 */
	protected void init(File outputDirectory, String pathPrefix, String tablePrefix, PropertyType ids, PropertyType attributes,
			Collection<String> sabList, List<String> additionalRootConcepts, long defaultTime) throws Exception
	{
		clearTargetFiles(outputDirectory);
		tablePrefix_ = tablePrefix;
		isRxNorm = tablePrefix_.equals("RXN");
		namespaceSeed_ = "gov.va.med.term.RRF." + tablePrefix + "." + pathPrefix;

		ptIds_ = ids;
		ptUMLSAttributes_ = attributes;

		abbreviationExpansions = AbbreviationExpansion.load(
				getClass().getResourceAsStream(isRxNorm ? "/RxNormAbbreviationsExpansions.txt" : "/UMLSAbbreviationExpansions.txt"));

		if (sabList != null && sabList.size() > 0)
		{
			sabQueryString_ += " (";
			for (String sab : sabList)
			{
				validateSab(sab);
				sabQueryString_ += "SAB='" + sab + "' or ";
				sabsInDB_.add(sab);
			}
			sabQueryString_ = sabQueryString_.substring(0, sabQueryString_.length() - 4);
			sabQueryString_ += ")";
		}
		else if (!isRxNorm)
		{
			Statement s = db_.getConnection().createStatement();
			ResultSet rs = s.executeQuery("Select distinct SAB from MRRANK");
			while (rs.next())
			{
				String sab = rs.getString("SAB");
				sabsInDB_.add(sab);
			}
			rs.close();

			rs = s.executeQuery("Select distinct SAB from MRSAT");
			while (rs.next())
			{
				String sab = rs.getString("SAB");
				sabsInDB_.add(sab);
			}
			rs.close();

			rs = s.executeQuery("Select distinct SAB from MRREL");
			while (rs.next())
			{
				String sab = rs.getString("SAB");
				sabsInDB_.add(sab);
			}
			rs.close();
			s.close();
		}

		File binaryOutputFile = new File(outputDirectory, "RRF-" + tablePrefix + ".jbin");

		dos_ = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(binaryOutputFile)));
		eConcepts_ = new EConceptUtility(namespaceSeed_, pathPrefix + " Path", dos_, defaultTime);

		UUID archRoot = ArchitectonicAuxiliary.Concept.ARCHITECTONIC_ROOT_CONCEPT.getPrimoridalUid();
		metaDataRoot_ = ConverterUUID.createNamespaceUUIDFromString("metadata");
		eConcepts_.createAndStoreMetaDataConcept(metaDataRoot_, (isRxNorm ? "RxNorm" : "UMLS") + " RRF Metadata", false, archRoot, dos_);

		if (!isRxNorm)
		{
			//Create the UMLS hierarchy root concept
			umlsRootConcept_ = eConcepts_.createConcept("UMLS Root Concepts");
			ConsoleUtil.println("Root concept FSN is 'UMLS Root Concepts' and the UUID is " + umlsRootConcept_.getPrimordialUuid());
			//We write this later, so callers can still add attributes to it.
		}

		loadMetaData(additionalRootConcepts);

		ConsoleUtil.println("Metadata Statistics");
		for (String s : eConcepts_.getLoadStats().getSummary())
		{
			ConsoleUtil.println(s);
		}

		eConcepts_.clearLoadStats();
		satRelStatement_ = db_.getConnection().prepareStatement("select * from " + tablePrefix_ + "SAT where " + (isRxNorm ? "RXAUI" : "METAUI")
				+ "= ? and STYPE='RUI' " + (sabQueryString_.length() > 0 ? "and" + sabQueryString_ : ""));
	}

	private void validateSab(String sab) throws Exception
	{
		Statement s = db_.getConnection().createStatement();
		ResultSet rs = s.executeQuery("Select SAB from " + tablePrefix_ + "CONSO where SAB = '" + sab + "' limit 1");
		if (!rs.next())
		{
			rs.close();
			//Check MRREL
			rs = s.executeQuery("Select SAB from " + tablePrefix_ + "REL where SAB = '" + sab + "' limit 1");
			if (!rs.next())
			{
				throw new Exception("Invalid sabFilter '" + sab + "'.  Perhaps you have mixed up VSABs and RSABs?");
			}
		}
		rs.close();
		s.close();
	}

	protected void finish(File outputDirectory) throws IOException, SQLException
	{
		checkRelationships();
		satRelStatement_.close();
		eConcepts_.storeRefsetConcepts(ptUMLSRefsets_, dos_);
		for (BPT_MemberRefsets r : ptRefsets_.values())
		{
			eConcepts_.storeRefsetConcepts(r, dos_);
		}
		if (umlsRootConcept_ != null)
		{
			umlsRootConcept_.writeExternal(dos_);
		}
		dos_.close();
		ConsoleUtil.println("Load Statistics");
		for (String s : eConcepts_.getLoadStats().getSummary())
		{
			ConsoleUtil.println(s);
		}

		if (!isRxNorm)
		{
			ConsoleUtil.println("Cross-Terminology Mapping Statistics");
			summarizeMappingRels();
		}

		//disabled debug code
		//conceptUUIDsUsedInRels_.removeAll(conceptUUIDsCreated_);
		//if (conceptUUIDsUsedInRels_.size() > 0)
		//{
		//	for (UUID uuid : conceptUUIDsUsedInRels_)
		//	{
		//		ConsoleUtil.printErrorln("ERROR!  Didn't create concept: " + uuid.toString());
		//	}
		//}

		// this could be removed from final release. Just added to help debug editor problems.
		ConsoleUtil.println("Dumping UUID Debug File");
		ConverterUUID.dump(outputDirectory, (isRxNorm ? "RxNorm" : "UMLS") + "UUID");
		ConsoleUtil.writeOutputToFile(new File(outputDirectory, "ConsoleOutput.txt").toPath());
	}

	private void clearTargetFiles(File outputDirectory)
	{
		new File(outputDirectory, (isRxNorm ? "RxNorm" : "UMLS") + "UUIDDebugMap.txt").delete();
		new File(outputDirectory, "ConsoleOutput.txt").delete();
		new File(outputDirectory, "RRF.jbin").delete();
	}

	protected abstract void loadCustomMetaData() throws Exception;
	protected abstract void addCustomRefsets(BPT_MemberRefsets refset) throws Exception;

	private void loadMetaData(List<String> additionalRootConcepts) throws Exception
	{
		ptUMLSRefsets_ = new PT_Refsets(isRxNorm ? "RxNorm RRF" : "UMLS");
		ptContentVersion_ = new BPT_ContentVersion();
		final PropertyType sourceMetadata = new PT_SAB_Metadata();
		ptRelationshipMetadata_ = new PT_Relationship_Metadata();
		ptUMLSRelationships_ = new PT_UMLS_Relationships();

		//don't load ptContentVersion_ yet - custom code might add to it
		eConcepts_.loadMetaDataItems(Arrays.asList(ptIds_, ptUMLSRefsets_, sourceMetadata, ptRelationshipMetadata_, ptUMLSAttributes_, ptUMLSRelationships_),
				metaDataRoot_, dos_);

		loadTerminologySpecificMetadata();

		//STYPE values
		ptSTypes_= new PropertyType("STYPEs"){};
		{
			ConsoleUtil.println("Creating STYPE types");
			ptSTypes_.indexByAltNames();
			Statement s = db_.getConnection().createStatement();
			ResultSet rs = s.executeQuery("SELECT DISTINCT VALUE, TYPE, EXPL FROM " + tablePrefix_ + "DOC where DOCKEY like 'STYPE%'");
			while (rs.next())
			{
				String sType = rs.getString("VALUE");
				String type = rs.getString("TYPE");
				String name = rs.getString("EXPL");

				if (!type.equals("expanded_form"))
				{
					throw new RuntimeException("Unexpected type in the attribute data within DOC: '" + type + "'");
				}

				ptSTypes_.addProperty(name, null, sType, null);
			}
			//T ODO maybe a bug in metamorphosys?  I know at one point, I didn't have these.. but they exist now... ignore
			//ptSTypes_.addProperty("Concept identifier", null, "CUI", null);
			//ptSTypes_.addProperty("Source asserted descriptor identifier", null, "SDUI", null);
			rs.close();
			s.close();
		}
		eConcepts_.loadMetaDataItems(ptSTypes_, metaDataRoot_, dos_);

		ptSuppress_=  xDocLoaderHelper("SUPPRESS", "Suppress", false);

		//Not yet loading co-occurrence data yet, so don't need these yet.
		//xDocLoaderHelper("COA", "Attributes of co-occurrence", false);
		//xDocLoaderHelper("COT", "Type of co-occurrence", true);

		final PropertyType contextTypes = xDocLoaderHelper("CXTY", "Context Type", false);

		//not yet loading mappings - so don't need this yet
		//xDocLoaderHelper("FROMTYPE", "Mapping From Type", false);
		//xDocLoaderHelper("TOTYPE", "Mapping To Type", false);
		//MAPATN - not yet used in UMLS

		// Handle the languages
		{
			ConsoleUtil.println("Creating language types");
			ptLanguages_ = new PropertyType("Languages"){};
			Statement s = db_.getConnection().createStatement();
			ResultSet rs = s.executeQuery("SELECT * from " + tablePrefix_ + "DOC where DOCKEY = 'LAT' and VALUE in (select distinct LAT from "
					+ tablePrefix_ + "CONSO " + (sabQueryString_.length() > 0 ? " where " + sabQueryString_ : "") + ")");
			while (rs.next())
			{
				String abbreviation = rs.getString("VALUE");
				String type = rs.getString("TYPE");
				String expansion = rs.getString("EXPL");

				if (!type.equals("expanded_form"))
				{
					throw new RuntimeException("Unexpected type in the language data within DOC: '" + type + "'");
				}

				Property p = ptLanguages_.addProperty(abbreviation, expansion, null);

				if (abbreviation.equals("ENG") || abbreviation.equals("SPA"))
				{
					// use official WB SCT languages
					if (abbreviation.equals("ENG"))
					{
						p.setWBPropertyType(UUID.fromString("c0836284-f631-3c86-8cfc-56a67814efab"));
					}
					else if (abbreviation.equals("SPA"))
					{
						p.setWBPropertyType(UUID.fromString("03615ef2-aa56-336d-89c5-a1b5c4cee8f6"));
					}
					else
					{
						throw new RuntimeException("oops");
					}
				}
			}
			rs.close();
			s.close();
			eConcepts_.loadMetaDataItems(ptLanguages_, metaDataRoot_, dos_);
		}

		// And Source Restriction Levels
		{
			ConsoleUtil.println("Creating Source Restriction Level types");
			ptSourceRestrictionLevels_ = new PropertyType("Source Restriction Levels"){};
			PreparedStatement ps = db_.getConnection().prepareStatement("SELECT VALUE, TYPE, EXPL from " + tablePrefix_ + "DOC where DOCKEY=? ORDER BY VALUE");
			ps.setString(1, "SRL");
			ResultSet rs = ps.executeQuery();

			String value = null;
			String description = null;
			String uri = null;

			//Two entries per SRL, read two rows, create an entry.

			while (rs.next())
			{
				String type = rs.getString("TYPE");
				String expl = rs.getString("EXPL");

				if (type.equals("expanded_form"))
				{
					description = expl;
				}
				else if (type.equals("uri"))
				{
					uri = expl;
				}
				else
				{
					throw new RuntimeException("oops");
				}

				if (value == null)
				{
					value = rs.getString("VALUE");
				}
				else
				{
					if (!value.equals(rs.getString("VALUE")))
					{
						throw new RuntimeException("oops");
					}

					if (description == null || uri == null)
					{
						throw new RuntimeException("oops");
					}

					Property p = ptSourceRestrictionLevels_.addProperty(value, null, description);
					final String temp = uri;
					p.registerConceptCreationListener(new ConceptCreationNotificationListener()
					{
						@Override
						public void conceptCreated(Property property, EConcept concept)
						{
							eConcepts_.addStringAnnotation(concept, temp, ptUMLSAttributes_.getProperty("URI").getUUID(), false);
						}
					});
					type = null;
					expl = null;
					value = null;
				}
			}
			rs.close();
			ps.close();

			eConcepts_.loadMetaDataItems(ptSourceRestrictionLevels_, metaDataRoot_, dos_);
		}

		// And Source vocabularies
		final PreparedStatement getSABMetadata = db_.getConnection().prepareStatement("Select * from " + tablePrefix_ + "SAB where (VSAB = ? or (RSAB = ? and CURVER='Y' ))");
		{
			ConsoleUtil.println("Creating Source Vocabulary types");
			ptSABs_ = new PropertyType("Source Vocabularies"){};
			ptSABs_.indexByAltNames();

			HashSet<String> sabList = new HashSet<>();
			sabList.addAll(sabsInDB_);

			Statement s = db_.getConnection().createStatement();
			ResultSet rs;
			if (isRxNorm)
			{
				rs = s.executeQuery("select distinct SAB from RXNSAT where ATN='NDC'");
				while (rs.next())
				{
					sabList.add(rs.getString("SAB"));
				}
				rs.close();
				s.close();
			}

			for (String currentSab : sabList)
			{
				s = db_.getConnection().createStatement();
				rs = s.executeQuery("SELECT SON from " + tablePrefix_ + "SAB WHERE (VSAB='" + currentSab + "' or (RSAB='" + currentSab + "' and CURVER='Y'))");
				if (rs.next())
				{
					String son = rs.getString("SON");

					Property p = ptSABs_.addProperty(son, null, currentSab, null);
					p.registerConceptCreationListener(new ConceptCreationNotificationListener()
					{
						@Override
						public void conceptCreated(Property property, EConcept concept)
						{
							try
							{
								//lookup the other columns for the row with this newly added RSAB terminology
								getSABMetadata.setString(1, property.getSourcePropertyAltName() == null ? property.getSourcePropertyNameFSN() : property.getSourcePropertyAltName());
								getSABMetadata.setString(2, property.getSourcePropertyAltName() == null ? property.getSourcePropertyNameFSN() : property.getSourcePropertyAltName());
								ResultSet rs = getSABMetadata.executeQuery();
								if (rs.next())  //should be only one result
								{
									for (Property metadataProperty : sourceMetadata.getProperties())
									{
										String columnName = metadataProperty.getSourcePropertyAltName() == null ? metadataProperty.getSourcePropertyNameFSN()
												: metadataProperty.getSourcePropertyAltName();
										String columnValue = rs.getString(columnName);
										if (columnValue == null)
										{
											continue;
										}
										if (columnName.equals("SRL"))
										{
											eConcepts_.addUuidAnnotation(concept, ptSourceRestrictionLevels_.getProperty(columnValue).getUUID(),
													metadataProperty.getUUID());
										}
										else if (columnName.equals("CXTY"))
										{
											eConcepts_.addUuidAnnotation(concept, contextTypes.getProperty(columnValue).getUUID(),
													metadataProperty.getUUID());
										}
										else
										{
											eConcepts_.addStringAnnotation(concept, columnValue, metadataProperty.getUUID(), false);
										}
									}
								}
								if (rs.next())
								{
									throw new RuntimeException("Too many sabs.  Perhaps you should be using versioned sabs!");
								}
								rs.close();
							}
							catch (SQLException e)
							{
								throw new RuntimeException("Error loading *SAB", e);
							}
						}
					});
				}
				else
				{
					throw new RuntimeException("Too few? SABs - perhaps you need to use versioned SABs.");
				}
				if (rs.next())
				{
					throw new RuntimeException("Too many SABs for '" + currentSab  + "' - perhaps you need to use versioned SABs.");
				}
				rs.close();
				s.close();
			}
			eConcepts_.loadMetaDataItems(ptSABs_, metaDataRoot_, dos_);
			getSABMetadata.close();
		}

		// And semantic types
		{
			ConsoleUtil.println("Creating semantic types");
			PropertyType ptSemanticTypes = new PropertyType("Semantic Types"){};
			Statement s = db_.getConnection().createStatement();
			ResultSet rs = s.executeQuery("SELECT distinct TUI, STN, STY from " + tablePrefix_+ "STY");
			while (rs.next())
			{
				final String tui = rs.getString("TUI");
				final String stn = rs.getString("STN");
				String sty = rs.getString("STY");

				Property p = ptSemanticTypes.addProperty(sty);
				semanticTypes_.put(tui, p.getUUID());
				p.registerConceptCreationListener(new ConceptCreationNotificationListener()
				{
					@Override
					public void conceptCreated(Property property, EConcept concept)
					{
						eConcepts_.addAdditionalIds(concept, tui, ptIds_.getProperty("TUI").getUUID(), false);
						eConcepts_.addStringAnnotation(concept, stn, ptUMLSAttributes_.getProperty("STN").getUUID(), false);
					}
				});
			}
			rs.close();
			s.close();

			eConcepts_.loadMetaDataItems(ptSemanticTypes, metaDataRoot_, dos_);
		}

		loadCustomMetaData();
		eConcepts_.loadMetaDataItems(ptContentVersion_, metaDataRoot_, dos_);

		findRootConcepts(additionalRootConcepts);
	}

	/*
	 * Note - may return null, if there were no instances of the requested data
	 */
	protected PropertyType xDocLoaderHelper(String dockey, String niceName, boolean loadAsDefinition) throws Exception
	{
		ConsoleUtil.println("Creating '" + niceName + "' types");
		PropertyType pt = new PropertyType(niceName) {};
		{
			if (!loadAsDefinition)
			{
				pt.indexByAltNames();
			}
			Statement s = db_.getConnection().createStatement();
			ResultSet rs = s.executeQuery("SELECT VALUE, TYPE, EXPL FROM " + tablePrefix_ + "DOC where DOCKEY='" + dockey + "'");
			while (rs.next())
			{
				String value = rs.getString("VALUE");
				String type = rs.getString("TYPE");
				String name = rs.getString("EXPL");

				if (value == null)
				{
					//there is a null entry, don't care about it.
					continue;
				}

				if (!type.equals("expanded_form"))
				{
					throw new RuntimeException("Unexpected type in the attribute data within DOC: '" + type + "'");
				}

				pt.addProperty((loadAsDefinition ? value : name), null, (loadAsDefinition ? null : value), (loadAsDefinition ? name : null));
			}
			rs.close();
			s.close();
		}
		if (pt.getProperties().size() == 0)
		{
			//This can happen, depending on what is included during the metamorphosys run
			ConsoleUtil.println("No entries found for '" + niceName + "' - skipping");
			return null;
		}
		eConcepts_.loadMetaDataItems(pt, metaDataRoot_, dos_);
		return pt;
	}

	private void loadTerminologySpecificMetadata() throws Exception
	{
		UUID mainNamespace = ConverterUUID.getNamespace();

		for (String sab : sabsInDB_)
		{
			UUID termSpecificMetadataRoot;
			String terminologyName;

			ConsoleUtil.println("Setting up metadata for " + sab);

			if (isRxNorm)
			{
				terminologyName = "RxNorm";
				//Change to a different namespace, so property types that are repeated in the metadata don't collide.
				ConverterUUID.configureNamespace(ConverterUUID.createNamespaceUUIDFromString(null, "gov.va.med.term.RRF." + tablePrefix_ + "." + terminologyName + ".metadata"));
			}
			else
			{
				Statement s = db_.getConnection().createStatement();
				ResultSet rs = s.executeQuery("Select SSN from MRSAB where RSAB ='" + sab + "' or VSAB='" + sab + "'");
				if (rs.next())
				{
					terminologyName = rs.getString("SSN");
				}
				else
				{
					throw new RuntimeException("Can't find name for " + sab);
				}

				//Change to a different namespace, so property types that are repeated in various UMLS terminologies don't collide.
				ConverterUUID.configureNamespace(ConverterUUID.createNamespaceUUIDFromString(null, "gov.va.med.term.RRF." + tablePrefix_ + "." + terminologyName + ".metadata"));
			}
			UUID archRoot = ArchitectonicAuxiliary.Concept.ARCHITECTONIC_ROOT_CONCEPT.getPrimoridalUid();
			termSpecificMetadataRoot = ConverterUUID.createNamespaceUUIDFromString("metadata");
			//If we have an item with 'special' snomed handling, hide it down under the UMLS RRF metadata - as we don't load any concepts related
			//to this terminology - just pulling relationships.
			eConcepts_.createAndStoreMetaDataConcept(termSpecificMetadataRoot, terminologyName + " Metadata", false,
					(specialHandling(sab) ? metaDataRoot_ : archRoot), dos_);

			//dynamically add more attributes from *DOC
			{
				ConsoleUtil.println("Creating attribute types");
				PropertyType annotations = new BPT_Annotations() {};
				annotations.indexByAltNames();

				Statement s = db_.getConnection().createStatement();
				//extra logic at the end to keep NDC's from any sab when processing RXNorm
				ResultSet rs = s.executeQuery("SELECT VALUE, TYPE, EXPL from " + tablePrefix_ + "DOC where DOCKEY = 'ATN' and VALUE in (select distinct ATN from "
						+ tablePrefix_ + "SAT" + " where SAB='" + sab + "'" + (isRxNorm ? " or ATN='NDC'" : "") + ")");
				while (rs.next())
				{
					String abbreviation = rs.getString("VALUE");
					String type = rs.getString("TYPE");
					String expansion = rs.getString("EXPL");

					if (!type.equals("expanded_form"))
					{
						throw new RuntimeException("Unexpected type in the attribute data within DOC: '" + type + "'");
					}

					String preferredName = null;
					String description = null;
					if (expansion.length() > 30)
					{
						description = expansion;
					}
					else
					{
						preferredName = expansion;
					}

					AbbreviationExpansion ae = abbreviationExpansions.get(abbreviation);
					if (ae == null)
					{
						ConsoleUtil.printErrorln("No Abbreviation Expansion found for " + abbreviation);
						annotations.addProperty(abbreviation, preferredName, description);
					}
					else
					{
						annotations.addProperty(ae.getExpansion(), null, ae.getAbbreviation(), ae.getDescription());
					}
				}
				if (isRxNorm)
				{
					annotations.addProperty("UMLSAUI");  //TODO bug in RxNorm - This property should be in RXNDOC, but it is currently missing - bug in the data
				}
				rs.close();
				s.close();

				if (annotations.getProperties().size() > 0)
				{
					eConcepts_.loadMetaDataItems(annotations, termSpecificMetadataRoot, dos_);
				}
				ptTermAttributes_.put(sab, annotations);
			}

			// And Descriptions
			{
				ConsoleUtil.println("Creating description types");
				PropertyType descriptions = new BPT_Descriptions(terminologyName);
				descriptions.indexByAltNames();
				Statement s = db_.getConnection().createStatement();
				ResultSet usedDescTypes;
				if (isRxNorm )
				{
					usedDescTypes = s.executeQuery("select distinct TTY from RXNCONSO WHERE SAB='" + sab + "'");
				}
				else
				{
					usedDescTypes = s.executeQuery("select distinct TTY from MRRANK WHERE SAB='" + sab + "'");
				}

				PreparedStatement ps = db_.getConnection().prepareStatement("select TYPE, EXPL from " + tablePrefix_ + "DOC where DOCKEY='TTY' and VALUE=?");

				while (usedDescTypes.next())
				{
					String tty = usedDescTypes.getString(1);
					ps.setString(1, tty);
					ResultSet descInfo = ps.executeQuery();

					String expandedForm = null;
					final HashSet<String> classes = new HashSet<>();

					while (descInfo.next())
					{
						String type = descInfo.getString("TYPE");
						String expl = descInfo.getString("EXPL");
						if (type.equals("expanded_form"))
						{
							if (expandedForm != null)
							{
								throw new RuntimeException("Expected name to be null!");
							}
							expandedForm = expl;
						}
						else if (type.equals("tty_class"))
						{
							classes.add(expl);
						}
						else
						{
							throw new RuntimeException("Unexpected type in DOC for '" + tty + "'");
						}
					}
					descInfo.close();
					ps.clearParameters();

					Property p = null;
					AbbreviationExpansion ae = abbreviationExpansions.get(tty);
					if (ae == null)
					{
						ConsoleUtil.printErrorln("No Abbreviation Expansion found for " + tty);
						p = makeDescriptionType(tty, expandedForm, null, null, classes);
					}
					else
					{
						p = makeDescriptionType(ae.getExpansion(), null, ae.getAbbreviation(), ae.getDescription(), classes);
					}

					descriptions.addProperty(p);
					p.registerConceptCreationListener(new ConceptCreationNotificationListener()
					{
						@Override
						public void conceptCreated(Property property, EConcept concept)
						{
							for (String tty_class : classes)
							{
								eConcepts_.addStringAnnotation(concept, tty_class, ptUMLSAttributes_.getProperty("tty_class").getUUID(), false);
							}
						}
					});

				}
				usedDescTypes.close();
				s.close();
				ps.close();

				ptDescriptions_.put(sab, descriptions);
				allDescriptionsCreated(sab);

				if (descriptions.getProperties().size() > 0)
				{
					eConcepts_.loadMetaDataItems(descriptions, termSpecificMetadataRoot, dos_);
				}
			}

			//Make a refset
			BPT_MemberRefsets refset = new BPT_MemberRefsets(terminologyName);
			terminologyCodeRefsetPropertyName_.put(sab, "All " + terminologyName + " Concepts");
			refset.addProperty(terminologyCodeRefsetPropertyName_.get(sab));
			addCustomRefsets(refset);
			ptRefsets_.put(sab, refset);
			eConcepts_.loadMetaDataItems(refset, termSpecificMetadataRoot, dos_);

			loadRelationshipMetadata(terminologyName, sab, termSpecificMetadataRoot);
		}
		//Go back to the primary namespace
		ConverterUUID.configureNamespace(mainNamespace);
	}

	private void findRootConcepts(List<String> additionalRoots) throws IOException, SQLException
	{
		if (isRxNorm)
		{
			return;
		}
		Statement statement = db_.getConnection().createStatement();
		ResultSet rs = statement.executeQuery("select * from MRHIER where PAUI is null");
		HashMap<String, UUID> sabRoots = new HashMap<>();
		while (rs.next())
		{
			String sab = rs.getString("SAB");
			UUID parent = sabRoots.get(sab);

			if (parent == null)
			{
				parent = ptSABs_.getProperty(sab).getUUID();
				//This concept was already created, so I can't add a rel to it - create a new concept with the same UUID, let the WB merge them.
				EConcept tempConcept = eConcepts_.createConcept(parent);
				eConcepts_.addRelationship(tempConcept, umlsRootConcept_.getPrimordialUuid());
				tempConcept.writeExternal(dos_);
			}

			rootConcepts_.put(rs.getString("CUI") + ":" + rs.getString("AUI"), parent);
		}
		rs.close();

		try
		{
			if (additionalRoots != null)
			{
				for (String s : additionalRoots)
				{
					String[] temp = s.split("\\|");
					String sab = temp[0];
					String cui = temp[1];
					String aui = temp[2];

					UUID parent = sabRoots.get(sab);

					if (parent == null)
					{
						parent = ptSABs_.getProperty(sab).getUUID();
						//This concept was already created, so I can't add a rel to it - create a new concept with the same UUID, let the WB merge them.
						EConcept tempConcept = eConcepts_.createConcept(parent);
						eConcepts_.addRelationship(tempConcept, umlsRootConcept_.getPrimordialUuid());
						tempConcept.writeExternal(dos_);
					}
					rootConcepts_.put(cui+ ":" + aui, parent);
				}
			}
		}
		catch (Exception e)
		{
			throw new RuntimeException("Couldn't parse the provided 'additionalRoots' - must be a 'SAB|CUI|AUI' triple", e);
		}
	}

	/**
	 * Returns the UUID of the concept this 'root' concept should link to, or null, if none.
	 */
	protected UUID isRootConcept(String cui, String aui)
	{
		return rootConcepts_.get(cui + ":" + aui);
	}

	/**
	 * Implementer needs to add an entry to ptDescriptions_ with the data provided...
	 */
	protected abstract Property makeDescriptionType(String fsnName, String preferredName, String altName, String description, final Set<String> tty_classes);

	/**
	 * Called just before the description set is actually created as eConcepts (in case the implementor needs to rank them all together)
	 */
	protected abstract void allDescriptionsCreated(String sab) throws Exception;

	protected abstract void processSAT(TkComponent<?> itemToAnnotate, ResultSet rs, String itemCode, String itemSab, boolean skipAuiAnnotation) throws SQLException;

	private void loadRelationshipMetadata(String terminologyName, String sab, UUID terminologyMetadataRoot) throws Exception
	{
		ConsoleUtil.println("Creating relationship types");
		//Both of these get added as extra attributes on the relationship definition
		HashMap<String, ArrayList<String>> snomedCTRelaMappings = new HashMap<>(); //Maps something like 'has_specimen_source_morphology' to '118168003' (may be more than one target SCT code)
		HashMap<String, String> snomedCTRelMappings = new HashMap<>();  //Maps something like '118168003' to 'RO'

		nameToRel_ = new HashMap<>();

		Statement s = db_.getConnection().createStatement();
		//get the inverses of first, before the expanded forms
		ResultSet rs = s.executeQuery("SELECT DOCKEY, VALUE, TYPE, EXPL FROM " + tablePrefix_ + "DOC where DOCKEY ='REL' or DOCKEY = 'RELA' order by TYPE DESC ");
		while (rs.next())
		{
			String dockey = rs.getString("DOCKEY");
			String value = rs.getString("VALUE");
			String type = rs.getString("TYPE");
			String expl = rs.getString("EXPL");
			if (value == null)
			{
				continue;  //don't need this one
			}

			if (type.equals("snomedct_rela_mapping"))
			{
				ArrayList<String> targetSCTIDs = snomedCTRelaMappings.get(expl);
				if (targetSCTIDs == null)
				{
					targetSCTIDs = new ArrayList<String>();
					snomedCTRelaMappings.put(expl, targetSCTIDs);
				}
				targetSCTIDs.add(value);
			}
			else if (type.equals("snomedct_rel_mapping"))
			{
				snomedCTRelMappings.put(value, expl);
			}
			else
			{
				Relationship rel = nameToRel_.get(value);
				if (rel == null)
				{
					if (type.endsWith("_inverse"))
					{
						rel = nameToRel_.get(expl);
						if (rel == null)
						{
							rel = new Relationship(dockey.equals("RELA"));
							nameToRel_.put(value, rel);
							nameToRel_.put(expl, rel);
						}
						else
						{
							throw new RuntimeException("shouldn't happen due to query order");
						}
					}
					else
					{
						//only cases where there is no inverse
						rel = new Relationship(dockey.equals("RELA"));
						nameToRel_.put(value, rel);
					}
				}

				if (type.equals("expanded_form"))
				{
					rel.addDescription(value, expl);
				}
				else if (type.equals("rela_inverse") || type.equals("rel_inverse"))
				{
					rel.addRelInverse(value, expl);
				}
				else
				{
					throw new RuntimeException("Oops");
				}
			}
		}

		rs.close();
		s.close();

		HashSet<String> actuallyUsedRelsOrRelas = new HashSet<>();

		for (Entry<String, ArrayList<String>> x : snomedCTRelaMappings.entrySet())
		{
			if (!nameToRel_.containsKey(x.getKey()))
			{
				//metamorphosys doesn't seem to remove these when the sct rel types aren't included - just silently remove them
				//unless it seems that they should map.
				if (isRxNorm || sab.startsWith("SNOMEDCT"))
				{
					//may_be_a appears to be a bug in RxNorm 2013-12-02.  silently ignore...
					//TODO see if they fix it in the future, make this check version specific?
					//seems to be getting worse... now it fails to remove 'has_life_circumstance' too in 2014AA, and a few others.
					//Changing to a warning.
					ConsoleUtil.printErrorln("Warning - The 'snomedct_rela_mapping' '" + x.getKey() + "' does not have a corresponding REL entry!  Skipping");
//					if (!x.getKey().equals("may_be_a") && !x.getKey().equals("has_life_circumstance"))
//					{
//						throw new RuntimeException("ERROR - No rel for " + x.getKey() + ".");
//					}
				}
				for (String sctId : x.getValue())
				{
					snomedCTRelMappings.remove(sctId);
				}
			}
			else
			{
				for (String sctid : x.getValue())
				{
					nameToRel_.get(x.getKey()).addSnomedCode(x.getKey(), sctid);
					String relType = snomedCTRelMappings.remove(sctid);
					if (relType != null)
					{
						nameToRel_.get(x.getKey()).addRelType(x.getKey(), relType);
						//Shouldn't need this, but there are some cases where the metadata is inconsistent - with how it is actually used.
						actuallyUsedRelsOrRelas.add(relType);
					}
				}
			}
		}

		if (snomedCTRelMappings.size() > 0)
		{
			for (Entry<String, String> x : snomedCTRelMappings.entrySet())
			{
				ConsoleUtil.printErrorln(x.getKey() + ":" + x.getValue());
			}
			throw new RuntimeException("oops - still have (things listed above)");

		}

		final PropertyType relationshipGeneric = new BPT_Relations("Relation Types Generic", terminologyName) {};
		relationshipGeneric.indexByAltNames();
		final PropertyType relationshipSpecificType = new BPT_Relations(terminologyName) {}; //Relation Types - default metadata node

		s = db_.getConnection().createStatement();
		rs = s.executeQuery("select distinct REL, RELA from " + tablePrefix_ + "REL where SAB='" + sab + "'");
		while (rs.next())
		{
			actuallyUsedRelsOrRelas.add(rs.getString("REL"));
			if (rs.getString("RELA") != null)
			{
				actuallyUsedRelsOrRelas.add(rs.getString("RELA"));
			}
		}
		rs.close();
		s.close();

		HashSet<Relationship> uniqueRels = new HashSet<>(nameToRel_.values());
		for (final Relationship r : uniqueRels)
		{
			r.setSwap(db_.getConnection(), tablePrefix_);

			if (!actuallyUsedRelsOrRelas.contains(r.getFSNName()) && !actuallyUsedRelsOrRelas.contains(r.getInverseFSNName()))
			{
				continue;
			}

			Property p;
			if (r.getIsRela())
			{
				if (r.getFSNName().equals("isa"))
				{
					p = new Property(r.getFSNName(), null, r.getDescription(), EConceptUtility.isARelUuid_);  //map to isA
					relationshipSpecificType.addProperty(p);
				}
				else
				{
					p = relationshipSpecificType.addProperty(r.getFSNName(), null, r.getDescription());
				}
			}
			else
			{
				if (r.getFSNName().equals("CHD"))
				{
					p = new Property((r.getAltName() == null ? r.getFSNName() : r.getAltName()), null, (r.getAltName() == null ? null : r.getFSNName()),
							r.getDescription(), EConceptUtility.isARelUuid_);  //map to isA
					relationshipGeneric.addProperty(p);
				}
				else
				{
					p = relationshipGeneric.addProperty((r.getAltName() == null ? r.getFSNName() : r.getAltName()), null,
							(r.getAltName() == null ? null : r.getFSNName()), r.getDescription());
				}
			}

			p.registerConceptCreationListener(new ConceptCreationNotificationListener()
			{
				@Override
				public void conceptCreated(Property property, EConcept concept)
				{
					if (r.getInverseFSNName() != null)
					{
						eConcepts_.addDescription(concept, (r.getInverseAltName() == null ? r.getInverseFSNName() : r.getInverseAltName()), DescriptionType.FSN,
								false, null, ptRelationshipMetadata_.getProperty("Inverse FSN").getUUID(), false);
					}

					if (r.getAltName() != null)
					{
						//Need to create this UUID to be different that forward name, in case forward and reverse are identical (like 'RO')
						UUID descUUID = ConverterUUID.createNamespaceUUIDFromStrings(concept.getPrimordialUuid().toString(), r.getInverseFSNName(),
								DescriptionType.SYNONYM.name(), "false", "inverse");
						//Yes, this looks funny, no its not a copy/paste error.  We swap the FSN and alt names for... it a long story.  42.
						eConcepts_.addDescription(concept, descUUID, r.getInverseFSNName(), DescriptionType.SYNONYM, false, null,
								ptRelationshipMetadata_.getProperty("Inverse Synonym").getUUID(), false);
					}

					if (r.getInverseDescription() != null)
					{
						eConcepts_.addDescription(concept, r.getInverseDescription(), DescriptionType.DEFINITION, true, null,
								ptRelationshipMetadata_.getProperty("Inverse Description").getUUID(), false);
					}

					if (r.getRelType() != null)
					{
						Relationship generalRel = nameToRel_.get(r.getRelType());

						eConcepts_.addUuidAnnotation(concept, relationshipGeneric.getProperty(generalRel.getFSNName()).getUUID(),
								ptRelationshipMetadata_.getProperty("General Rel Type").getUUID());
					}

					if (r.getInverseRelType() != null)
					{
						Relationship generalRel = nameToRel_.get(r.getInverseRelType());

						eConcepts_.addUuidAnnotation(concept, relationshipGeneric.getProperty(generalRel.getFSNName()).getUUID(),
								ptRelationshipMetadata_.getProperty("Inverse General Rel Type").getUUID());
					}

					for (String sctCode : r.getRelSnomedCode())
					{
						eConcepts_.addUuidAnnotation(concept, Type3UuidFactory.fromSNOMED(sctCode),
								ptRelationshipMetadata_.getProperty("Snomed Code").getUUID());
					}

					for (String sctCode : r.getInverseRelSnomedCode())
					{
						eConcepts_.addUuidAnnotation(concept, Type3UuidFactory.fromSNOMED(sctCode),
								ptRelationshipMetadata_.getProperty("Inverse Snomed Code").getUUID());
					}
				}
			});
		}

		if (relationshipGeneric.getProperties().size() > 0)
		{
			eConcepts_.loadMetaDataItems(relationshipGeneric, terminologyMetadataRoot, dos_);
		}
		ptRelationshipGeneric_.put(sab, relationshipGeneric);
		if (relationshipSpecificType.getProperties().size() > 0)
		{
			eConcepts_.loadMetaDataItems(relationshipSpecificType, terminologyMetadataRoot, dos_);
		}
		ptRelationshipSpecificTypes_.put(sab, relationshipSpecificType);
	}

	protected void processSemanticTypes(EConcept concept, ResultSet rs) throws SQLException
	{
		while (rs.next())
		{
			TkRefexUuidMember annotation = eConcepts_.addUuidAnnotation(concept, semanticTypes_.get(rs.getString("TUI")), ptUMLSAttributes_.getProperty("STY").getUUID());
			if (rs.getString("ATUI") != null)
			{
				eConcepts_.addAdditionalIds(annotation, rs.getString("ATUI"), ptIds_.getProperty("ATUI").getUUID());
			}

			if (rs.getObject("CVF") != null)  //might be an int or a string
			{
				eConcepts_.addStringAnnotation(annotation, rs.getString("CVF"), ptUMLSAttributes_.getProperty("CVF").getUUID(), false);
			}
		}
		rs.close();
	}

	/**
	 * Add the attribute value(s) for each given type, with nested attributes linking to the AUI(s) that they came from.
	 */
	protected void loadGroupStringAttributes(TkComponent<?> component, UUID annotationRefset, HashMap<UUID, HashMap<String, HashSet<String>>> values, boolean skipNestedAUIs)
	{
		for (Entry<UUID, HashMap<String, HashSet<String>>> dataType : values.entrySet())
		{
			for (Entry<String, HashSet<String>> valueAui : dataType.getValue().entrySet())
			{
				String value = valueAui.getKey();
				TkRefsetStrMember attribute = eConcepts_.addStringAnnotation(component, value, dataType.getKey(), false);
				if (!skipNestedAUIs)
				{
					for (String aui : valueAui.getValue())
					{
						eConcepts_.addStringAnnotation(attribute, aui, annotationRefset, false);
					}
				}
			}
		}
	}

	/**
	 * Add the attribute value(s) for each given type, with nested attributes linking to the AUI(s) that they came from.
	 */
	protected void loadGroupUUIDAttributes(TkComponent<?> component, UUID annotationRefset, HashMap<UUID, HashMap<UUID, HashSet<String>>> values, boolean skipNestedAUIs)
	{
		for (Entry<UUID, HashMap<UUID, HashSet<String>>> dataType : values.entrySet())
		{
			for (Entry<UUID, HashSet<String>> valueAui : dataType.getValue().entrySet())
			{
				UUID value = valueAui.getKey();
				TkRefexUuidMember attribute = eConcepts_.addUuidAnnotation(component, value, dataType.getKey());
				if (!skipNestedAUIs)
				{
					for (String aui : valueAui.getValue())
					{
						eConcepts_.addStringAnnotation(attribute, aui, annotationRefset, false);
					}
				}
			}
		}
	}

	protected void addAttributeToGroup(HashMap<UUID, HashMap<String, HashSet<String>>> group, UUID typeForColName, String value, String aui)
	{
		if (value == null)
		{
			return;
		}
		HashMap<String, HashSet<String>> colData = group.get(typeForColName);
		if (colData == null)
		{
			colData = new HashMap<>();
			group.put(typeForColName, colData);
		}
		HashSet<String> auis = colData.get(value);
		if (auis == null)
		{
			auis = new HashSet<>();
			colData.put(value, auis);
		}
		if (aui != null)
		{
			auis.add(aui);
		}
	}

	protected void addAttributeToGroup(HashMap<UUID, HashMap<UUID, HashSet<String>>> group, UUID typeForColName, UUID value, String aui)
	{
		if (value == null)
		{
			return;
		}
		HashMap<UUID, HashSet<String>> colData = group.get(typeForColName);
		if (colData == null)
		{
			colData = new HashMap<>();
			group.put(typeForColName, colData);
		}
		HashSet<String> auis = colData.get(value);
		if (auis == null)
		{
			auis = new HashSet<>();
			colData.put(value, auis);
		}
		if (aui != null)
		{
			auis.add(aui);
		}
	}

	protected UUID createCUIConceptUUID(String cui)
	{
		return ConverterUUID.createNamespaceUUIDFromString("CUI:" + cui, true);
	}

	protected UUID createCuiSabCodeConceptUUID(String cui, String sab, String code)
	{
		return ConverterUUID.createNamespaceUUIDFromString("CODE:" + cui + ":" + sab + ":" + code, true);
	}

	/**
	 * @throws SQLException
	 */
	protected void addRelationships(EConcept concept, List<REL> relationships) throws SQLException
	{
		HashMap<UUID, List<REL>> uniqueRels = new HashMap<>();

		//preprocess - set up the source and target UUIDs for this rel, so we can identify duplicates.
		//Note - the duplicates we are detecting here are rels that point to the same WB code concept, that occur
		//due to the way that we combine AUI's.  This is not detecting duplicates caused by forward/reverse rels in the UMLS.
		for (REL relationship : relationships)
		{
			relationship.setSourceUUID(concept.getPrimordialUuid());

			if (!relationship.hasSnomedSpecialHandling())
			{
				if (relationship.getSourceAUI() == null)
				{
					relationship.setTargetUUID(createCUIConceptUUID(relationship.getTargetCUI()));
				}
				else
				{
					relationship.setTargetUUID(createCuiSabCodeConceptUUID((isRxNorm ? relationship.getRxNormTargetCUI() : relationship.getTargetCUI()),
							relationship.getTargetSAB(), relationship.getTargetCode()));
				}
			}

			List<REL> rels = uniqueRels.get(relationship.getRelHash());
			if (rels == null)
			{
				rels = new ArrayList<REL>(4);
				uniqueRels.put(relationship.getRelHash(), rels);
			}
			rels.add(relationship);
		}

		for (List<REL> duplicateRels : uniqueRels.values())
		{
			//We currently don't check the properties on the (duplicate) inverse rels to make sure they are all present - we assume that they
			//created the inverse relationships as an exact copy of the primary rel direction.  So, just checking the first rel from our dupe list is good enough
			if (isRelPrimary(duplicateRels.get(0).getRel(), duplicateRels.get(0).getRela()))
			{
				//This can happen when the reverse of the rel equals the rel... sib/sib
				if (relCheckIsRelLoaded(duplicateRels.get(0)))
				{
					continue;
				}

				Property relType = null;
				if (duplicateRels.get(0).getRela() == null)
				{
					relType = ptRelationshipGeneric_.get(duplicateRels.get(0).getSab()).getProperty(duplicateRels.get(0).getRel());
				}
				else
				{
					relType = ptRelationshipSpecificTypes_.get(duplicateRels.get(0).getSab()).getProperty(duplicateRels.get(0).getRela());
				}

				TkRelationship r;

				if (relType.getWBTypeUUID() == null)
				{
					r = eConcepts_.addRelationship(concept, (duplicateRels.get(0).getRui() != null ? ConverterUUID.createNamespaceUUIDFromString("RUI:" + duplicateRels.get(0).getRui()) : null),
							duplicateRels.get(0).getTargetUUID(), relType.getUUID(), null, null, null, null);
				}
				else  //need to swap out to the wb rel type (usually, isa)
				{
					r = eConcepts_.addRelationship(concept, (duplicateRels.get(0).getRui() != null ? ConverterUUID.createNamespaceUUIDFromString("RUI:" + duplicateRels.get(0).getRui()) : null),
							duplicateRels.get(0).getTargetUUID(), relType.getWBTypeUUID(), relType.getUUID(), relType.getPropertyType().getPropertyTypeReferenceSetUUID(), null, null);
				}

				if (!isRxNorm)
				{
					//stats gathering, nothing more
					countMappingRel(duplicateRels.get(0).getSourceSAB(), duplicateRels.get(0).getTargetSAB(), relType.getSourcePropertyNameFSN());
				}

				//disabled debug code
				//conceptUUIDsUsedInRels_.add(concept.getPrimordialUuid());
				//conceptUUIDsUsedInRels_.add(duplicateRels.get(0).getTargetUUID());

				HashMap<UUID, HashMap<String, HashSet<String>>> stringAttributes = new HashMap<>();
				HashMap<UUID, HashMap<UUID, HashSet<String>>> uuidAttributes = new HashMap<>();

				//Now we have created a single relationship for this REL - iterate all of the duplicate definitions of this rel to pick up all of the unique annotations
				//that we need.
				for (REL dupeRel : duplicateRels)
				{
					//on second thought, don't really need these on UMLS terms either.
					//if (!isRxNorm)  //dropped for space concerns
					//{
					//	addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("STYPE1").getUUID(), dupeRel.getStype1(), dupeRel.getSourceTargetAnnotationLabel());
					//	addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("STYPE2").getUUID(), dupeRel.getStype2(), dupeRel.getSourceTargetAnnotationLabel());
					//}
					if (dupeRel.getRela() != null)  //we already used rela - annotate with rel.
					{
						Property genericType = ptRelationshipGeneric_.get(dupeRel.getSab()).getProperty(dupeRel.getRel());
						boolean reversed = false;
						if (genericType == null && dupeRel.getRela().equals("mapped_from"))
						{
							//This is to handle non-sensical data in UMLS... they have no consistency in the generic rel they assign - sometimes RB, sometimes RN.
							//reverse it - currently, only an issue on 'mapped_from' rels - as the code in Relationship.java has some exceptions for this type.
							genericType = ptRelationshipGeneric_.get(dupeRel.getSab()).getProperty(reverseRel(dupeRel.getRel()));
							reversed = true;
						}
						addAttributeToGroup(uuidAttributes, ptUMLSAttributes_.getProperty(reversed ? "Generic rel type (inverse)" : "Generic rel type").getUUID(),
								genericType.getUUID(), dupeRel.getSourceTargetAnnotationLabel());
					}
					if (dupeRel.getRui() != null)
					{
						eConcepts_.addAdditionalIds(r, dupeRel.getRui(), ptIds_.getProperty("RUI").getUUID());
						satRelStatement_.clearParameters();
						satRelStatement_.setString(1, dupeRel.getRui());
						ResultSet nestedRels = satRelStatement_.executeQuery();
						processSAT(r, nestedRels, null, dupeRel.getSab(), false);
					}
					if (!isRxNorm && dupeRel.getSrui() != null)
					{
						addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("SRUI").getUUID(), dupeRel.getSrui(), dupeRel.getSourceTargetAnnotationLabel());
					}

					if (!isRxNorm)
					{
						//always rxnorm for rxnorm, don't bother loading.
						addAttributeToGroup(uuidAttributes, ptUMLSAttributes_.getProperty("SAB").getUUID(),
								ptSABs_.getProperty(dupeRel.getSab()).getUUID(), dupeRel.getSourceTargetAnnotationLabel());
					}
					if (!isRxNorm && dupeRel.getSl() != null && !dupeRel.getSl().equals(dupeRel.getSab()))  //I don't  think this ever actually happens
					{
						addAttributeToGroup(uuidAttributes, ptUMLSAttributes_.getProperty("SL").getUUID(),
								ptSABs_.getProperty(dupeRel.getSl()).getUUID(), dupeRel.getSourceTargetAnnotationLabel());
					}
					if (dupeRel.getRg() != null)
					{
						addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("RG").getUUID(), dupeRel.getRg(), dupeRel.getSourceTargetAnnotationLabel());
					}
					if (dupeRel.getDir() != null)
					{
						addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("DIR").getUUID(), dupeRel.getDir(), dupeRel.getSourceTargetAnnotationLabel());
					}
					if (dupeRel.getSuppress() != null)
					{
						addAttributeToGroup(uuidAttributes, ptUMLSAttributes_.getProperty("SUPPRESS").getUUID(),
								ptSuppress_.getProperty(dupeRel.getSuppress()).getUUID(), dupeRel.getSourceTargetAnnotationLabel());
					}

					//Add an attribute that says which relationship this attribute came from (can't use RUI, as it isn't provided consistently)
					eConcepts_.addStringAnnotation(r, dupeRel.getSourceTargetAnnotationLabel(), ptRelationshipMetadata_.getProperty("sAUI & tAUI").getUUID(), false);

				}

				loadGroupStringAttributes(r, ptRelationshipMetadata_.getProperty("sAUI & tAUI").getUUID(), stringAttributes, false);
				loadGroupUUIDAttributes(r, ptRelationshipMetadata_.getProperty("sAUI & tAUI").getUUID(), uuidAttributes, false);
				processRelCVFAttributes(r, duplicateRels);

				relCheckLoadedRel(duplicateRels.get(0));
			}
			else
			{
				relCheckSkippedRel(duplicateRels.get(0));
			}
		}
	}

	//This is overridden by RXNorm, which handles it differently
	protected void processRelCVFAttributes(TkRelationship r, List<REL> duplicateRelationships)
	{
		HashMap<UUID, HashMap<String, HashSet<String>>> stringAttributes = new HashMap<>();
		for (REL dupeRel : duplicateRelationships)
		{
			if (dupeRel.getCvf() != null)
			{
				addAttributeToGroup(stringAttributes, ptUMLSAttributes_.getProperty("CVF").getUUID(), dupeRel.getCvf(), dupeRel.getSourceTargetAnnotationLabel());
			}
		}
		loadGroupStringAttributes(r, ptRelationshipMetadata_.getProperty("sAUI & tAUI").getUUID(), stringAttributes, false);
	}

	//This is overridden by UMLS, which treats Snomed special in some cases
	protected boolean specialHandling(String sab)
	{
		return false;
	}

	private boolean isRelPrimary(String relName, String relaName)
	{
		if (relaName != null)
		{
			return nameToRel_.get(relaName).getFSNName().equals(relaName);
		}
		else
		{
			return nameToRel_.get(relName).getFSNName().equals(relName);
		}
	}

	public String reverseRel(String eitherRelType)
	{
		if (eitherRelType == null)
		{
			return null;
		}
		Relationship r = nameToRel_.get(eitherRelType);
		if (r.getFSNName().equals(eitherRelType))
		{
			return r.getInverseFSNName();
		}
		else if (r.getInverseFSNName().equals(eitherRelType))
		{
			return r.getFSNName();
		}
		else
		{
			throw new RuntimeException("gak");
		}

	}

	private void relCheckLoadedRel(REL rel)
	{
		loadedRels_.add(rel.getRelHash());
		skippedRels_.remove(rel.getRelHash());
	}

	private boolean relCheckIsRelLoaded(REL rel)
	{
		return loadedRels_.contains(rel.getRelHash());
	}

	/**
	 * Call this when a rel wasn't added because the rel was listed with the inverse name, rather than the primary name.
	 */
	private void relCheckSkippedRel(REL rel)
	{
		skippedRels_.add(rel.getInverseRelHash(this));
	}

	private void checkRelationships()
	{
		//if the inverse relationships all worked properly, skipped should be empty when loaded is subtracted from it.
		for (UUID uuid : loadedRels_)
		{
			skippedRels_.remove(uuid);
		}

		if (skippedRels_.size() > 0)
		{
			ConsoleUtil.printErrorln("Relationship design error - " +  skippedRels_.size() + " were skipped that should have been loaded");
		}
		else
		{
			ConsoleUtil.println("Yea! - no missing relationships!");
		}
	}

	@Override
	public Log getLog()
	{
		// noop
		return null;
	}

	@Override
	public void setLog(Log arg0)
	{
		//noop
	}

	private void countMappingRel(String sourceSAB, String targetSAB, String relName)
	{
		String source = sourceSAB == null ? "<CUI>" : sourceSAB;
		String target = targetSAB == null ? "<CUI>" : targetSAB;

		if (source.equals(target) && !source.equals("<CUI>"))
		{
			return;
		}
		HashMap<String, HashMap<String, AtomicInteger>> targetToType = mappingRelCounters_.get(source);
		if (targetToType == null)
		{
			targetToType = new HashMap<>();
			mappingRelCounters_.put(source, targetToType);
		}
		HashMap<String, AtomicInteger> typeToCount = targetToType.get(target);
		if (typeToCount == null)
		{
			typeToCount = new HashMap<>();
			targetToType.put(target, typeToCount);
		}

		AtomicInteger count = typeToCount.get(relName);
		if (count == null)
		{
			count = new AtomicInteger(0);
			typeToCount.put(relName, count);
		}
		count.incrementAndGet();
	}

	protected void summarizeMappingRels()
	{
		for (Entry<String, HashMap<String, HashMap<String, AtomicInteger>>> counter : mappingRelCounters_.entrySet())
		{
			String source = counter.getKey();
			for (Entry<String, HashMap<String, AtomicInteger>> targets : counter.getValue().entrySet())
			{
				String target = targets.getKey();
				for (Entry<String, AtomicInteger> types : targets.getValue().entrySet())
				{
					ConsoleUtil.println("Source - " + source + " - Target - " +  target + " - Type - " + types.getKey() + " - " +  types.getValue().get());
				}
			}
		}
	}
}


text:
'use strict';
var expect = require('chai').expect;
var writeLog = require('../lib/writeLog');

describe('writeLog', function() {
  it('should throw if no version can be found', function(done) {
    var commits = [];
    var options = {
      pkg: 'test/fixtures/_malformation.json'
    };

    writeLog(commits, options, function(err) {
      expect(err).to.equal('No version specified');
      done();
    });
  });
  it('should get the correct version from package.json', function(done) {
    var commits = [];
    var options = {
      pkg: 'test/fixtures/_package.json'
    };

    writeLog(commits, options, function(err, changelog) {
      expect(err).to.be.a('null');
      expect(changelog).to.contain('1.0.0');
      done();
    });
  });
});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get all information stored in an ID3 tag</title>

id3_get_genre_name

id3_get_version

ID3 Functions

PHP Manual

id3_get_tag

(PECL id3 >= 0.1)

id3_get_tag — Get all information stored in an ID3 tag

Description

   array id3_get_tag
    ( string $filename
   [, int $version = ID3_BEST
  ] )

   id3_get_tag() is used to get all information stored
   in the id3 tag of the specified file.

Parameters

filename

       The path to the MP3 file

       Instead of a filename you may also pass a valid stream resource

version

       Allows you to specify the version of the tag as MP3 files may contain
       both, version 1.x and version 2.x tags

       Since version 0.2 id3_get_tag() also supports ID3
       tags of version 2.2, 2.3 and 2.4. To extract information from these
       tags, pass one of the constants ID3_V2_2, ID3_V2_3 or ID3_V2_4 as the
       second parameter.
       ID3 v2.x tags can contain a lot more information about the MP3 file
       than ID3 v1.x tags.

Return Values

   Returns an associative array with various keys like:
   title, artist, ..

   The key genre will contain an integer between 0 and
   147. You may use id3_get_genre_name() to convert it to
   a human readable string.

Examples

Example #1 id3_get_tag() example

<?php
$tag = id3_get_tag( "path/to/example.mp3" );
print_r($tag);
?>

The above example will output
something similar to:

Array
(
    [title] => DN-38416
    [artist] => Re:\Legion
    [album] => Reflections
    [year] => 2004
    [genre] => 19
)

Example #2 id3_get_tag() example

<?php
$tag = id3_get_tag( "path/to/example2.mp3", ID3_V2_3 );
print_r($tag);
?>

The above example will output
something similar to:

Array
(
    [copyright] => Dirty Mac
    [originalArtist] => Dirty Mac
    [composer] => Marcus Götze
    [artist] => Dirty Mac
    [title] => Little Big Man
    [album] => Demo-Tape
    [track] => 5/12
    [genre] => (17)Rock
    [year] => 2001
)

See Also

id3_set_tag() - Update information stored in an ID3 tag

id3_remove_tag() - Remove an existing ID3 tag

id3_get_version() - Get version of an ID3 tag

id3_get_genre_name

id3_get_version

ID3 Functions

PHP Manual


text:
@interface CollectionViewCell()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIButton *bgButton;
@property (weak, nonatomic) IBOutlet UIView *labelBgView;

@end
@implementation CollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.labelBgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self = [[NSBundle mainBundle]loadNibNamed:@"CollectionViewCell"     owner:self options:nil].lastObject;
        self.labelBgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];

    }
    return self;
}

- (void)setModel:(StyleModel *)model{
    _model = model;
    self.nameLabel.text = model.name;
    [self.bgButton setImage:[UIImage imageNamed:model.imageName] forState:UIControlStateNormal];
}
- (IBAction)clilck:(id)sender {
    if (_clickBlock) {
        _clickBlock(self.model.type);
    }
}

@end


text:
package org.neo4j.kernel.impl.core;

public interface TokenFactory<TOKEN>
{
    TOKEN newToken( String name, int id );
}