Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java examples: CreateMapping throws java.lang.Exception #6

Open
jvendetti opened this issue Sep 12, 2017 · 2 comments
Open

Java examples: CreateMapping throws java.lang.Exception #6

jvendetti opened this issue Sep 12, 2017 · 2 comments

Comments

@jvendetti
Copy link
Member

Executing the main method in CreateMapping.java results in the following exception:

java.lang.Exception: {"errors":["Input does not contain classes"],"status":400}
	at CreateMapping.postJSON(CreateMapping.java:98)
	at CreateMapping.main(CreateMapping.java:51)
@jvendetti jvendetti self-assigned this Sep 12, 2017
@jvendetti jvendetti added the bug label Sep 12, 2017
@jvendetti
Copy link
Member Author

Looks like the sample code stopped working after this Aug., 2014 commit:

ncbo/ontologies_api@af851ff#diff-2c60916f20816a3d25cac7bafac3b587

... changed one of the required input parameter names from "terms" to "classes".

@jvendetti
Copy link
Member Author

On further recent investigation, the exception results not just from a change in parameter names for the /mappings endpoint. The example code is also generating JSON that's not compliant with what the endpoint is expecting. This is an example of the JSON that's currently generated:

{
  "creator" : "http://stagedata.bioontology.org/user/vendetti",
  "relation" : "http://www.w3.org/2002/07/owl#sameAs",
  "source" : "MY_USER",
  "source_name" : "MyUsers's Mapping Data",
  "comment" : "This mapping creates a same as mapping between melanoma (NCIT) and melanoma (SNOMEDCT)",
  "terms" : [ {
    "ontology" : "NCIT",
    "class" : [ "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C8711" ]
  }, {
    "ontology" : "SNOMEDCT",
    "class" : [ "http://purl.bioontology.org/ontology/SNOMEDCT/372244006" ]
  } ]
}

... and this is an example of the JSON structure that the mappings endpoint requires:

{
  "creator" : "http://data.bioontology.org/user/vendetti",
  "relation" : "http://www.w3.org/2002/07/owl#sameAs",
  "source" : "vendetti",
  "source_name" : "Jennifer's Test Mapping Data",
  "comment" : "Creates a same as mapping between Melanoma (NCIT) and Malignant melanoma (SNOMEDCT)",
  "classes" : { 
    "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C3224" : "NCIT",
    "http://purl.bioontology.org/ontology/SNOMEDCT/2092003":"SNOMEDCT"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants