Skip to content

Commit

Permalink
Merge pull request #61 from HHS/meshrdf-dev
Browse files Browse the repository at this point in the history
Changes for MeSH 2016
  • Loading branch information
danizen committed Nov 19, 2015
2 parents 0dccb57 + cf68e98 commit f36bfe3
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 25 deletions.
25 changes: 18 additions & 7 deletions bin/fetch-mesh-xml.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/bin/sh -e
#!/bin/bash


while getopts "h:y:u:" opt; do
case $opt in
h) export MESHRDF_HOME=$OPTARG ;;
y) export MESHRDF_YEAR=$OPTARG ;;
u) export MESHRDF_URI=$OPTARG ;;
*) echo "Usage: $0 [-h meshrdf-home] [-y year] [-u uri] [-i]" 1>&2 ; exit 1 ;;
esac
done
shift $(($OPTIND - 1))

if [ -z "$MESHRDF_HOME" ]; then
echo "Please define MESHRDF_HOME environment variable" 1>&2
Expand All @@ -8,18 +19,18 @@ fi
mkdir -p "$MESHRDF_HOME/data"

# CAn override default year with MESHRDF_YEAR environment variable
YEAR=${MESHRDF_YEAR:-2015}
YEAR=${MESHRDF_YEAR:-2016}

# Can override default URI with MESHRDF_URI environment variable
URI=${MESHRDF_URI:-ftp://ftp.nlm.nih.gov/online/mesh/$YEAR}

wget "$URI/desc$YEAR.dtd" -O "$MESHRDF_HOME/data/desc$YEAR.dtd"
wget "$URI/desc$YEAR.xml" -O "$MESHRDF_HOME/data/desc$YEAR.xml"
wget "$URI/pa$YEAR.dtd" -O "$MESHRDF_HOME/data/pa$YEAR.dtd"
wget "$URI/pa$YEAR.xml" -O "$MESHRDF_HOME/data/pa$YEAR.xml"
wget "$URI/qual$YEAR.dtd" -O "$MESHRDF_HOME/data/qual$YEAR.dtd"
wget "$URI/qual$YEAR.xml" -O "$MESHRDF_HOME/data/qual$YEAR.xml"
wget "$URI/supp$YEAR.dtd" -O "$MESHRDF_HOME/data/supp$YEAR.dtd"
wget "$URI/supp$YEAR.xml" -O "$MESHRDF_HOME/data/supp$YEAR.xml"

if [ $YEAR -le 2015 ]; then
wget "$URI/desc$YEAR.dtd" -O "$MESHRDF_HOME/data/desc$YEAR.dtd"
wget "$URI/qual$YEAR.dtd" -O "$MESHRDF_HOME/data/qual$YEAR.dtd"
wget "$URI/supp$YEAR.dtd" -O "$MESHRDF_HOME/data/supp$YEAR.dtd"
fi

13 changes: 12 additions & 1 deletion bin/mesh-xml2rdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ else
fi
cd $($READLINK -e `dirname $0`/..)

while getopts "h:j:y:u" opt; do
case $opt in
h) export MESHRDF_HOME=$OPTARG ;;
j) export SAXON_JAR=$OPTARG ;;
y) export MESHRDF_YEAR=$OPTARG ;;
u) export MESHRDF_URI_YEAR="yes" ;;
*) echo "Usage: $0 [-h mesh-rdf-home] [-j saxon-jar-path] [-y year ]" 1>&2 ; exit 1 ;;
esac
done
shift $(($OPTIND - 1))

# Check for some needed environment variables
if [ -z "$MESHRDF_HOME" ]; then
echo "Please define MESHRDF_HOME environment variable" 1>&2
Expand All @@ -42,7 +53,7 @@ if [ -z "$SAXON_JAR" ]; then
fi

# Can override default year with MESHRDF_YEAR environment variable
YEAR=${MESHRDF_YEAR:-2015}
YEAR=${MESHRDF_YEAR:-2016}

# Set the output file name, and the parameter that controls the RDF URIs,
# according to whether or not MESHRDF_URI_YEAR is "yes"
Expand Down
38 changes: 37 additions & 1 deletion meta/vocabulary.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<http://id.nlm.nih.gov/mesh/vocab#> rdf:type :Ontology ;

:versionInfo "0.9" .
:versionInfo "0.9.3" .


#################################################################
Expand Down Expand Up @@ -304,6 +304,18 @@ dct:description rdf:type :AnnotationProperty .



### http://id.nlm.nih.gov/mesh/vocab#active

<http://id.nlm.nih.gov/mesh/vocab#active> rdf:type :DatatypeProperty ;

rdfs:label "active" ;

dct:description "A property of MeSH objects indicating whether they still appear in the current version of the most recently released MeSH year" ;

rdfs:range xsd:boolean .



### http://id.nlm.nih.gov/mesh/vocab#altLabel

<http://id.nlm.nih.gov/mesh/vocab#altLabel> rdf:type :DatatypeProperty ;
Expand Down Expand Up @@ -418,6 +430,18 @@ dct:description rdf:type :AnnotationProperty .



### http://id.nlm.nih.gov/mesh/vocab#lastActive

<http://id.nlm.nih.gov/mesh/vocab#lastActiveYear> rdf:type :DatatypeProperty ;

rdfs:label "lastActiveYear" ;

dct:description "The lastActiveYear property value is the year in which the subject last appeared. If that year is still hosted, a new URI can be constructed." ;

rdfs:range xsd:string .



### http://id.nlm.nih.gov/mesh/vocab#lexicalTag

<http://id.nlm.nih.gov/mesh/vocab#lexicalTag> rdf:type :DatatypeProperty ;
Expand All @@ -428,6 +452,18 @@ dct:description rdf:type :AnnotationProperty .



### http://id.nlm.nih.gov/mesh/vocab#nlmClassificationNumber

<http://id.nlm.nih.gov/mesh/vocab#nlmClassificationNumber> rdf:type :DatatypeProperty ;

rdfs:label "nlmClassificationNumber" ;

dct:description "Each MeSH Descriptor has a corresponding class number in the NLM Classification. This classification is similar to the Library of Congress Classification (LCC).";

rdfs:range xsd:string .



### http://id.nlm.nih.gov/mesh/vocab#note

<http://id.nlm.nih.gov/mesh/vocab#note> rdf:type :DatatypeProperty ;
Expand Down
16 changes: 4 additions & 12 deletions meta/void.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
dcterms:creator "U.S. National Library of Medicine" ;
dcterms:date "2014-11-01"^^xsd:date ;
foaf:primaryTopic <http://id.nlm.nih.gov/mesh/void#MeSHRDF> ;
owl:versionInfo "0.9" .
owl:versionInfo "0.9.3" .


# Metadata description of the Dataset
Expand Down Expand Up @@ -57,15 +57,7 @@
void:exampleResource <http://id.nlm.nih.gov/mesh/D000001> ;

# FTP dump file
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/2014/desc2014.nt" ;
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/2014/qual2014.nt" ;
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/2014/supp2014.nt" ;
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/mesh.nt" ;
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/2016/mesh2016.nt" ;
void:dataDump "ftp://ftp.nlm.nih.gov/online/mesh/2015/mesh2015.nt" .

# triple count
void:triples "16644674"^^xsd:long ;

# entity count
void:entities "1925662"^^xsd:long ;

# distinct subject
void:distinctSubjects "1925662"^^xsd:long .
59 changes: 55 additions & 4 deletions xslt/desc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<xsl:for-each select="DescriptorRecordSet/DescriptorRecord">

<xsl:variable name='descriptor_id' select='DescriptorUI'/>
<xsl:variable name='descriptor_label' select='DescriptorName/String'/>

<!--
Transformation rule: meshv:identifier
Expand All @@ -27,7 +28,7 @@
<xsl:value-of select="$descriptor_id"/>
</uri>
</xsl:variable>

<xsl:call-template name='triple'>
<xsl:with-param name="doc">
<desc>This relation states that a descriptor record has a unique identifier.</desc>
Expand Down Expand Up @@ -82,7 +83,7 @@
<xsl:copy-of select="$descriptor_uri"/>
<uri prefix='&rdfs;'>label</uri>
<literal lang='en'>
<xsl:value-of select="DescriptorName/String"/>
<xsl:value-of select='$descriptor_label'/>
</literal>
</xsl:with-param>
</xsl:call-template>
Expand Down Expand Up @@ -129,6 +130,22 @@
</xsl:with-param>
</xsl:call-template>

<!--
Give it a label
-->
<xsl:call-template name='triple'>
<xsl:with-param name="doc">
<desc>Provide a name for the AllowedDescriptorQualifierPair</desc>
</xsl:with-param>
<xsl:with-param name="spec">
<xsl:copy-of select='$dqpair_uri'/>
<uri prefix='&rdfs;'>label</uri>
<literal lang='en'>
<xsl:value-of select="concat($descriptor_label, '/', QualifierReferredTo/QualifierName/String)"/>
</literal>
</xsl:with-param>
</xsl:call-template>

<!--
Link it back to the descriptor
-->
Expand Down Expand Up @@ -157,7 +174,25 @@
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>


<!--
NLMClassificationNumber
-->
<xsl:if test="NLMClassificationNumber">
<xsl:call-template name='triple'>
<xsl:with-param name="doc">
<desc>Each descriptor may have an NLMClassificationNumber.</desc>
</xsl:with-param>
<xsl:with-param name='spec'>
<xsl:copy-of select="$descriptor_uri"/>
<uri prefix='&meshv;'>nlmClassificationNumber</uri>
<literal>
<xsl:value-of select="NLMClassificationNumber"/>
</literal>
</xsl:with-param>
</xsl:call-template>
</xsl:if>

<!--
Transformation rule: publicMeSHNote
-->
Expand All @@ -176,7 +211,7 @@
</xsl:with-param>
</xsl:call-template>
</xsl:if>

<xsl:for-each select="EntryCombinationList/EntryCombination">

<xsl:variable name='ecin_uri'>
Expand All @@ -200,6 +235,22 @@
</xsl:with-param>
</xsl:call-template>

<!--
Give it a label
-->
<xsl:call-template name='triple'>
<xsl:with-param name="doc">
<desc>Provide a label for the DisallowedDescriptorQualifierPair.</desc>
</xsl:with-param>
<xsl:with-param name="spec">
<xsl:copy-of select='$ecin_uri'/>
<uri prefix='&rdfs;'>label</uri>
<literal lang='en'>
<xsl:value-of select="concat(ECIN/DescriptorReferredTo/DescriptorName/String,
'/', ECIN/QualifierReferredTo/QualifierName/String)"/>
</literal>
</xsl:with-param>
</xsl:call-template>
<!--
Link it back to the descriptor
-->
Expand Down

0 comments on commit f36bfe3

Please sign in to comment.