A Bit of Git for CDISC

Along with JIRA and the Confluence Wiki, CDISC has added the Atlassian Bitbucket distributed version control system to our online toolset. CDISC finally has a Git-based version control system, and several projects have already started using it. In cases where a standard is under development, the repository may be private to the team and not accessible by others. However, I anticipate a growing number of publicly accessible CDISC Bitbucket projects. The XML Technologies and SHARE teams are using Bitbucket and will have publicly accessible projects. Trace-XML is one such project. More on this in an upcoming post.

You can find Bitbucket from the CDISC Wiki or JIRA by selecting the drop-down menu in the upper left-hand corner of either application, as shown in the graphic below. If you haven't used Git or Bitbucket before there are numerous online tutorials to get you started.

Most code developed in a project of mine will have a repository on Bitbucket. That said, there are times when I'd like to share a quick example or very small program without the complexity of a full repository. Now that we're using Bitbucket, I was interested to learn that Bitbucket has a Gist counterpart called Snippets. For those of you not familiar with Gist or Snippets, these are tools for sharing a file, or small set of files, simply. The CDISC community will find such a tool for sharing example files to be very useful. To get us started I've created my first snippet as described below. Since I'm sharing a code snippet, the remainder of this topic gets a wee bit technical.

Recently I've had a few requests to cover Define-XML v2.0 schema validation in Java, as it's not as straight forward as it sounds.  I'll add a small example program to demonstrate Define-XML validation as my first snippet. There may well be many different options for validating Define-XML in Java, but the example program works when combined with a very small change to the define-extension.xsd schema file. You need to change the xs:redefine schemaLocation attribute to reference the ODM1-3-2-foundation.xsd file instead of the ODM1-3-2.xsd file. The line to change exists near the top of the define-extension.xsd schema file. Basically, you change this line:

<xs:redefine schemaLocation="../cdisc-odm-1.3.2/ODM1-3-2.xsd">

To this line:

<xs:redefine schemaLocation="../cdisc-odm-1.3.2/ODM1-3-2-foundation.xsd">

This change assumes your Define-XML v2.0 schemas are organized in a directory structure that matches the way you unzipped them after downloading the standards package from the CDISC web site. If not, adjust the schemaLocation attribute value to the location of the ODM1-3-2-foundation.xsd file on your system. On the off chance that making a change to a Define-XML v2.0 schema file concerns you, the XML Technologies team has already implemented this same change in the soon-to-be-published Define-XML v2.1 schema.

The example Java program to schema validate Define-XML v2.0 is located on Bitbucket as a snippet. It's the first snippet added to our Bitbucket instance. Within Bitbucket, select the Snippets and then the Browse menu items. The name of the snippet is DefineValidate.

Once you've updated the schema file and you've downloaded the DefineValidate.java code found in the snippet, compile and run the application.  This is a command-line application that takes two command-line arguments: (1) the name including path for the Define-XML v2.0 file to validate, and (2) the name including path of the top-level Define-XML schema file (e.g. define2-0-0.xsd) that references the newly updated define-extension.xsd schema file. For example:

Java -jar DefineValidate.jar d:\cdisc\odm\Validate\define2-0-0\define2-0-0-sdtm.xml d:\cdisc\odm\Validate\schema\define2-0-0\define2-0-0.xsd

Look for more open Bitbucket projects and snippets soon.

Note: I used Java 8 to compile this snippet. However, the java.xml.validation package was introduced in Java 5, and is also available in Java 1.3 and later if you install JAXP 1.3. Keeping this in mind, you may have luck compiling the code on older Java versions.

Comments

Popular posts from this blog

Value Level Metadata, Vertically Structured Datasets, and Normalizaton

ODMv2: Renovating the ODM Standard

What’s the difference between iSHARE and eSHARE?