Research Entities

88 views
Skip to first unread message

Aboubakr Aly Badr

unread,
Jul 5, 2021, 10:01:56 AM7/5/21
to DSpace Technical Support

Hello,

I am getting this error when trying to apply the Research Entities model to my test instance. Using this command:
dspace dsrun org.dspace.app.util.InitializeEntities -f relationship-types.xml

Exception: null
java.lang.NullPointerException
    at org.dspace.app.util.InitializeEntities.parseXMLToRelations(InitializeEntities.java:131)
    at org.dspace.app.util.InitializeEntities.run(InitializeEntities.java:106)
    at org.dspace.app.util.InitializeEntities.main(InitializeEntities.java:77)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:277)
    at org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:133)
    at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:98)

The relationship-types.xml is attached.
Any help?
Thanks a lot
Aboubakr Aly Badr
relationship-types.xml

Mark H. Wood

unread,
Jul 6, 2021, 12:12:35 PM7/6/21
to dspac...@googlegroups.com
On Mon, Jul 05, 2021 at 02:24:41AM -0700, Aboubakr Aly Badr wrote:
> I am getting this error when trying to apply the Research Entities model to
> my test instance. Using this command:
> dspace dsrun org.dspace.app.util.InitializeEntities -f
> relationship-types.xml
>
> Exception: null
> java.lang.NullPointerException
> at
> org.dspace.app.util.InitializeEntities.parseXMLToRelations(InitializeEntities.java:131)

That line assumes the existence of at least one 'leftwardType' element
as a child of each 'type' element and tries to extract the text
content of the first one found.

https://github.com/DSpace/DSpace/blob/87bb9e44f07d11126eaa5dc194cdd885fa2f0058/dspace-api/src/main/java/org/dspace/app/util/InitializeEntities.java#L131

Your 'relationship-types.xml' contains 'type' elements having no
'leftwardType' elements. The code does not guard against missing
elements, so it throws a NullPointerException.

I'm not yet familiar enough with the entities configuration to say
whether your file or the code is incorrect. The code *is* fragile and
*does* throw an uninformative exception.

> The relationship-types.xml is attached.
> Any help?
> Thanks a lot
> Aboubakr Aly Badr
>
> --
> All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
> ---
> You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/5296b0d2-bd3e-49ec-bcc3-f1e605706987n%40googlegroups.com.

> <?xml version="1.0" encoding="UTF-8"?>
> <relationships>
> <type>
> <leftType>Publication</leftType>
> <rightType>Person</rightType>
> <leftLabel>isAuthorOfPublication</leftLabel>
> <rightLabel>isPublicationOfAuthor</rightLabel>
> <leftCardinality>
> <min>0</min>
> <!--<max></max> not specified, unlimited-->
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> <!--<max></max> not specified, unlimited-->
> </rightCardinality>
> </type>
> <type>
> <leftType>Publication</leftType>
> <rightType>Project</rightType>
> <leftLabel>isProjectOfPublication</leftLabel>
> <rightLabel>isPublicationOfProject</rightLabel>
> <leftCardinality>
> <min>0</min>
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> </rightCardinality>
> </type>
> <type>
> <leftType>Publication</leftType>
> <rightType>OrgUnit</rightType>
> <leftLabel>isOrgUnitOfPublication</leftLabel>
> <rightLabel>isPublicationOfOrgUnit</rightLabel>
> <leftCardinality>
> <min>0</min>
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> </rightCardinality>
> </type>
> <type>
> <leftType>Person</leftType>
> <rightType>Project</rightType>
> <leftLabel>isProjectOfPerson</leftLabel>
> <rightLabel>isPersonOfProject</rightLabel>
> <leftCardinality>
> <min>0</min>
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> </rightCardinality>
> </type>
> <type>
> <leftType>Person</leftType>
> <rightType>OrgUnit</rightType>
> <leftLabel>isOrgUnitOfPerson</leftLabel>
> <rightLabel>isPersonOfOrgUnit</rightLabel>
> <leftCardinality>
> <min>0</min>
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> </rightCardinality>
> </type>
> <type>
> <leftType>Project</leftType>
> <rightType>OrgUnit</rightType>
> <leftLabel>isOrgUnitOfProject</leftLabel>
> <rightLabel>isProjectOfOrgUnit</rightLabel>
> <leftCardinality>
> <min>0</min>
> </leftCardinality>
> <rightCardinality>
> <min>0</min>
> </rightCardinality>
> </type>
> </relationships>

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
signature.asc

Aboubakr Aly Badr

unread,
Jul 16, 2021, 3:36:25 AM7/16/21
to DSpace Technical Support
Thanks Mark for your answer.

Indeed my xml file contained an old label "rightLabel", once change it to "rightwardType" the command executed with no errors.
Will need to figure out the rest of steps to enable the model on the frontend.

Best regards
Aly
Reply all
Reply to author
Forward
0 new messages