Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Issue92: map annotation/namespace definitions from external yml file #118

Merged
merged 5 commits into from
Apr 12, 2016

Conversation

rumilbaybikov
Copy link
Contributor

No description provided.

@abargnesi
Copy link
Member

It looks like we have duplicate options between --resource-override and --rdf-prefix-file.

Maybe a better name is --resource-mapping-file?

@rumilbaybikov rumilbaybikov reopened this Apr 1, 2016
@rumilbaybikov
Copy link
Contributor Author

then to avoid duplicates we could define 1 common yml file with structure below:

prefixes:
belr: 'http://www.openbel.org/bel/'
belv: 'http://www.openbel.org/vocabulary/'
...
namespaces:
remap:
from:
to:
...
annotations:
remap:
from:
keyword: "Anatomy"
type: "url"
domain: "http://example.com/anatomy.belanno"
to:
keyword: "Anatomy"
type: "url"
domain: "http://example.com/anatomy.belanno/anatomy.belanno"
rdf_uri: "http://identifiers.org/anatomy/"

@abargnesi
Copy link
Member

This is looking good. Nice work! 🎉

The tests all pass, but I noticed one issue when I try to translate BEL Script to Turtle when using an RDF prefix file.

I ran this test from the root of the project using the BEL Script file ./test/resources/small_corpus.bel and the rdf prefix file examples/resource-mapping.yml.

# Using bel2rdf.rb
bin/bel2rdf.rb --bel ./test/resources/small_corpus.bel --format turtle --rdf-prefix-file examples/resource-mapping.yml

# Using "bel translate"
bel translate --input-file ./test/resources/small_corpus.bel --to-option rdf_prefix_file=examples/resource-mapping.yml bel turtle

The turtle includes @prefix directives with what looks like Ruby code:

@prefix annotations: <[{"remap"=>{"from"=>{"keyword"=>"Anatomy", "type"=>"url", "domain"=>"http://resource.belframework.org/belframework/20150611/annotation/anatomy.belanno"}, "to"=>{"keyword"=>"Anatomy", "type"=>"url", "domain"=>"http://resource.belframework.org/belframework/20150611/annotation/anatomy.belanno", "rdf_uri"=>"http://identifiers.org/anatomy/"}}}, {"remap"=>{"from"=>{"keyword"=>"TextLocation", "type"=>"list", "domain"=>["Abstract", "Results", "Legend", "Review"]}, "to"=>{"keyword"=>"TextLocation", "type"=>"pattern", "domain"=>"Value[0-9]+", "rdf_uri"=>"http://identifiers.org/text-location/"}}}]> .
@prefix namespaces: <[{"remap"=>{"from"=>{"prefix"=>"HGNC", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/hgnc-human-genes.belns"}, "to"=>{"prefix"=>"HGNC", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/hgnc-human-genes.belns", "rdf_uri"=>"http://identifiers.org/hgnc/"}}}, {"remap"=>{"from"=>{"prefix"=>"EGID", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/entrez-gene-ids.belns"}, "to"=>{"prefix"=>"EGID", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/entrez-gene-ids.belns", "rdf_uri"=>"http://identifiers.org/ncbigene/"}}}, {"remap"=>{"from"=>{"prefix"=>"MESHD", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/mesh-diseases.belns"}, "to"=>{"prefix"=>"MESHD", "url"=>"http://resource.belframework.org/belframework/20150611/namespace/mesh-diseases.belns", "rdf_uri"=>"http://identifiers.org/meshd/"}}}]> .

This error looks like the wrong object type is being set as an RDF prefix.

@abargnesi
Copy link
Member

Actually, I was sending a resource override file and not an RDF prefix file. I think that is why I got this behavior.

When I run the following bel translate it looks correct:

bin/bel translate --input-file test/resources/small_corpus.bel -t rdf_prefix_file=test/resources/prefix_file.yml bel turtle

@abargnesi
Copy link
Member

It looks like we are missing a resource_override option in the bel translate help information. That's a minor point we can update after.

@abargnesi abargnesi merged commit 6c8b8bf into OpenBEL:master Apr 12, 2016
abargnesi pushed a commit that referenced this pull request Apr 12, 2016
abargnesi pushed a commit that referenced this pull request Apr 12, 2016
IMO, the name "remap-file" seems to indicate the format and intented
usage of this file.

updated references throughout the usage.

expanded on option documentation and made consistent across *bel* and
*bel2rdf.rb* files.

refs #118
abargnesi pushed a commit that referenced this pull request Apr 12, 2016
The remapfile subcommand has been added to *bel* to give the user an
example document to start from. Otherwise users who install the gem will
not know how to structure a remap file.

refs #118
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants