Issues attempting to parse works

152 views
Skip to first unread message

Kevin Van de Velde

unread,
Feb 21, 2017, 6:27:20 AM2/21/17
to ORCID API Users
Hi,

We are attempting to use the new ORCID V2.0 api to import works into a repository based on the ORCID identifier. To do this we are using the following call: 

curl -H "Accept: application/orcid+xml" 'https://pub.sandbox.orcid.org/v2.0/0000-0002-9227-8514/works'

The resulting xml should be then be parsed to java classes using JAXB, but this doesn't appear to work.

One of the problems appears to be that the xml returned by the call above contains: "activities:group" while the activities only appear to mention "work-group", see: https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.0/activities-2.0.xsd#L193


Are we missing something ? Are we using the wrong xsd file, wrong call ?

Kind regards,

Kevin Van de Velde

Angel Montenegro

unread,
Feb 21, 2017, 12:59:30 PM2/21/17
to ORCID API Users
Hi Kevin

Whats the error you see? 


If you look at the activities xsd, the works uses the work-group, but, the name of that element is group, so, you get the activities:group element;

<xs:complexType name="works">
<xs:sequence>
<xs:element ref="common:last-modified-date" minOccurs="0" maxOccurs="1" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="group"
type="activities:work-group" />
</xs:sequence>
<xs:attribute name="path" type="common:element-path" use="optional" />
</xs:complexType>

Thanks

Monica Duke

unread,
Feb 22, 2017, 4:21:47 AM2/22/17
to Angel Montenegro, ORCID API Users

Is there a definition for the element group in the activities schema (or elsewhere), or is it enough for it to be listed as an element within the complex type definitions, so that a group element in the namespace activities is defined? (forgive my rusty xsd definition knowledge)

 

Or, put a different way, where is the definition for http://www.orcid.org/ns/activities:group element found?

 

Monica

 

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/d/optout.


Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.

Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.

Monic...@jisc.ac.uk

unread,
Feb 22, 2017, 4:52:17 AM2/22/17
to ORCID API Users
Trying to answer my earlier question, further interpreting the schema, the activities:group element is defined in different places within the outer complexType definition (fundings, peer reviews etc) which each restrict the element to be of a specific respective complexType (peer-review-group, funding-group etc)

Does this mean there isn't one activities:group element, but several different ones, defined by the scope of their outer complexType definition?

Monica

Angel Montenegro

unread,
Feb 22, 2017, 10:17:16 AM2/22/17
to ORCID API Users
Hi Monica, 

Yes, you are right, there isn't a definition of activities:group, the scope is defined by the outer complex type (activities:funding-group, activities:peer-review-group and activities:work-group depending on the activity type)

Thanks

Kevin Van de Velde

unread,
Feb 27, 2017, 10:05:23 AM2/27/17
to Angel Montenegro, ORCID API Users
Hi Angel,

Thanks for your help so far, but when we try to run the test our provided locally on our machine we get the following exception:

java.lang.RuntimeException: Unable to unmarshall orcid messagejavax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 81; cvc-elt.1: Cannot find the declaration of element 'activities:works'.]
at org.orcid.record.ValidateV2SamplesTest.unmarshall(ValidateV2SamplesTest.java:1162)
at org.orcid.record.ValidateV2SamplesTest.unmarshallFromPath(ValidateV2SamplesTest.java:1095)
at org.orcid.record.ValidateV2SamplesTest.testUnmarshallWorks(ValidateV2SamplesTest.java:1034)


Kind regards,

logoKevin Van de Velde
250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
Esperantolaan 4, Heverlee 3001, Belgium
atmire.com



--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Angel Montenegro

unread,
Feb 27, 2017, 11:02:36 AM2/27/17
to ORCID API Users, a.mont...@ost.orcid.org
Hi Kevin, 

Weird, I just tested it on my local (Win 10) and on our CI machine (Ubuntu 14.02) and it work fine there.

How are you running those tests?

- What OS are you using?
- What version of java are you on? 
- Are you running it on Maven, or in eclipse, or other?
- Are you running it in the master branch?

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.

Kevin Van de Velde

unread,
Mar 1, 2017, 10:43:46 AM3/1/17
to Angel Montenegro, ORCID API Users
Hi Angel,

Thanks for your reply, we are using the following:

  • OS: OSX
  • Java version: Java 8
  • Running in: Intellij, although running in intellij shouldn't make a difference I think ?
  • We are indeed working from master


Kind regards,

logoKevin Van de Velde
250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
Esperantolaan 4, Heverlee 3001, Belgium
atmire.com



To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Angel Montenegro

unread,
Mar 1, 2017, 11:02:58 AM3/1/17
to ORCID API Users, a.mont...@ost.orcid.org
Hey Kevin, 

Hummm I dont use intellij, I use Eclipse STS, however, the test works fine for me.

Lets try two things, 

1) First, please verify that you have the file ORCID-Source/orcid-model/src/main/resources/record_2.0/samples/read_samples/work-2.0.xml and that it is UTF-8 encoded

2) Please run the test with maven on the command line:

cd ORCID-Source/orcid-model/
mvn -Dtest=ValidateV2SamplesTest test

Please let me know how it goes.

Thanks

Kevin Van de Velde

unread,
Mar 3, 2017, 10:12:09 AM3/3/17
to Angel Montenegro, ORCID API Users, jo...@atmire.com
Hi Angel.

The tests are now running as intended. There was a slight inconsistency in the local activities-2.0.xsd file.


The actual unmarshalling of the retrieved works is still broken though.

It seems that a required element "<common:external-ids>" with it's children is not present in the returning document/xml.
The tests pas because the example read_samples/works-2.0.xml contains this required element.

The definition in the xsd stating that this element is required.

If you were to curl the example ORCIDid used in the example "0000-0002-9227-8514" it will not return this element, thus resulting in an "invalid" xml.


Additionally, could you provide some more information about how the actual Java classes are produced.
  • Is the java created based on the XSL? Or vice versa?
  • If so, what has been used to accommodate for this conversion? JaxB for example?
  • If not, is there any place where one could find the actual java classes accumulated in 1 jar, for example using maven. Because now, all classes and all different versions are simply present in the ORCID-Source codebase and there isn't a concise way to integrate them into another codebase.

Kind regards,

logoKevin Van de Velde
250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
Esperantolaan 4, Heverlee 3001, Belgium
atmire.com



To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.
ORCID-maven-test-output-2017-03-02.txt

Montenegro, Angel

unread,
Mar 3, 2017, 10:50:02 AM3/3/17
to Kevin Van de Velde, ORCID API Users, jo...@atmire.com
Hi Kevin,

"It seems that a required element "<common:external-ids>" with it's children is not present in the returning document/xml."

I don't see that error in any of the works calls: 


All of them return the external-ids for each work, could you please share your curl call?

And, regarding your questions:

1) Is the java created based on the XSL? Or vice versa?
2) If so, what has been used to accommodate for this conversion? JaxB for example?

- Yes, the java code is generated based on the XSD using JAXB, for this we use Eclipse STS which have a tool to generate the code.

3) If not, is there any place where one could find the actual java classes accumulated in 1 jar, for example using maven. Because now, all classes and all different versions are simply present in the ORCID-Source codebase and there isn't a concise way to integrate them into another codebase.

-No, unfortunately we don't have any maven repo for our code yet, it is a good idea that you can share in the ORCID ideas forum: 

Kevin Van de Velde

unread,
Mar 7, 2017, 7:50:12 AM3/7/17
to Montenegro, Angel, ORCID API Users, jo...@atmire.com
Hi, Angel

I'm, sorry we should have been a bit more specific.

As you said, the returning work-summary elements do contain this external-ids, as seen in the samples works-2.0.xml used in testing http://tinyurl.com/h24lzqn
But, I was actually talking about the first occurrence of this "external-ids", the direct child of the "activities:group" element. http://tinyurl.com/h9xb433

If you were to take the example curl for the /works and use resulting xml as the basis of the testUnmarshallWorks test, http://tinyurl.com/j7xlpng you'll see what I mean, this test will then fail.

Kind regards,

logoKevin Van de Velde
250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
Esperantolaan 4, Heverlee 3001, Belgium
atmire.com



Angel Montenegro

unread,
Mar 7, 2017, 8:32:36 AM3/7/17
to ORCID API Users, a.mont...@ost.orcid.org, jo...@atmire.com
Hi Kevin, 

This is an error on our side, I sent a pull request to fix it and it might be deployed in the following days: 


Thanks for helping us find this problem.

Thanks
Reply all
Reply to author
Forward
0 new messages