Rothamsted / knetbuilder

KnetBuilder data integration platform for building knowledge graphs. Previously known as ondex.
https://knetminer.com
MIT License
12 stars 11 forks source link

Parsing co_321.owl throws an error #41

Closed KeywanHP closed 2 years ago

KeywanHP commented 3 years ago

Using ondex-mini-3.0 and the latest co_cfg.xml and following workflow snippet:

Need a way to add the CO_321: prefix to accessions...

<Parser name="owlParser">
    <Arg name="graphId">default</Arg>
    <Arg name="InputFile">${baseDir}/ontologies/co_321.owl</Arg>        
    <Arg name="configFile">${configDir}/generic/ontologies/co_cfg.xml</Arg>
</Parser>
Expanded workflow can be found at: /tmp/test_co_wf.xml8057266839365871070expanded
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultOwlMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/default_mappings.xml]: Cannot resolve reference to bean 'conceptMapper' while setting bean property 'conceptMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conceptMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/default_mappings.xml]: Cannot resolve reference to bean 'accessionsMapper' while setting bean property 'accessionsMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessionsMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Cannot create inner bean 'idAccMapper$child#51dbd6e4' while setting bean property 'mappers' with key [0]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'idAccMapper$child#51dbd6e4' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Could not resolve parent bean definition 'idAccMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'idAccMapper' available
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
    at net.sourceforge.ondex.parser.owl.OWLMapper.mapFrom(OWLMapper.java:147)
    at net.sourceforge.ondex.parser.owl.plugin.OWLParser.start(OWLParser.java:81)
    at net.sourceforge.ondex.workflow.engine.Engine.runParser(Engine.java:443)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor$5.run(PluginProcessor.java:135)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor$5.run(PluginProcessor.java:133)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor.execute(PluginProcessor.java:83)
    at net.sourceforge.ondex.workflow.engine.BasicJobImpl.run(BasicJobImpl.java:110)
    at net.sourceforge.ondex.WorkflowMain.main(WorkflowMain.java:216)
    at net.sourceforge.ondex.OndexMiniMain.main(OndexMiniMain.java:7)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conceptMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/default_mappings.xml]: Cannot resolve reference to bean 'accessionsMapper' while setting bean property 'accessionsMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessionsMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Cannot create inner bean 'idAccMapper$child#51dbd6e4' while setting bean property 'mappers' with key [0]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'idAccMapper$child#51dbd6e4' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Could not resolve parent bean definition 'idAccMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'idAccMapper' available
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessionsMapper' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Cannot create inner bean 'idAccMapper$child#51dbd6e4' while setting bean property 'mappers' with key [0]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'idAccMapper$child#51dbd6e4' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Could not resolve parent bean definition 'idAccMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'idAccMapper' available
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedSet(BeanDefinitionValueResolver.java:394)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:161)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 33 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'idAccMapper$child#51dbd6e4' defined in URL [file:/home/data/knetminer/pub/config/generic/ontologies/co_cfg.xml]: Could not resolve parent bean definition 'idAccMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'idAccMapper' available
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1278)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
    ... 45 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'idAccMapper' available
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:687)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1207)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:985)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1262)
    ... 46 more
srun: error: rothhpc401: task 0: Exited with exit code 2

Also tried test wheat CO workflow from here, with error:

Error: Could not open and parse the workflow file. See stack trace for details.
Expanded workflow can be found at: /tmp/test_co_wf.xml391592625769402541expanded
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [file:/home/data/knetminer/software//ondex-mini/config/owl-parser/co_cfg.xml]
Offending resource: URL [file:/home/data/knetminer/pub/config/triticum_aestivum/owl-parser/co_wheat_cfg.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 65 in XML document from URL [file:/home/data/knetminer/software//ondex-mini/config/owl-parser/co_cfg.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 65; columnNumber: 54; Element type "property" must be followed by either attribute specifications, ">" or "/>".
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:233)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:184)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:169)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:613)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:514)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
    at net.sourceforge.ondex.parser.owl.OWLMapper.mapFrom(OWLMapper.java:147)
    at net.sourceforge.ondex.parser.owl.plugin.OWLParser.start(OWLParser.java:81)
    at net.sourceforge.ondex.workflow.engine.Engine.runParser(Engine.java:443)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor$5.run(PluginProcessor.java:135)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor$5.run(PluginProcessor.java:133)
    at net.sourceforge.ondex.workflow.engine.PluginProcessor.execute(PluginProcessor.java:83)
    at net.sourceforge.ondex.workflow.engine.BasicJobImpl.run(BasicJobImpl.java:110)
    at net.sourceforge.ondex.WorkflowMain.main(WorkflowMain.java:216)
    at net.sourceforge.ondex.OndexMiniMain.main(OndexMiniMain.java:7)
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 65 in XML document from URL [file:/home/data/knetminer/software//ondex-mini/config/owl-parser/co_cfg.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 65; columnNumber: 54; Element type "property" must be followed by either attribute specifications, ">" or "/>".
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:227)
    ... 28 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 65; columnNumber: 54; Element type "property" must be followed by either attribute specifications, ">" or "/>".
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
    ... 33 more
srun: error: rothhpc401: task 0: Exited with exit code 2
marco-brandizi commented 3 years ago

See the commit 491f96f, which should fix it. The first problem is caused by the fact that you need to import the right base file, the hierarchy is: default_mappings <- obo_common_mappings <- <yourfile>.

idAccMapper, used by your file, is an OBO-specific thing, which maps the values of the oboInOwl:id property to Ondex accessions.

As for the second problem, while I didn't check co_wheat_cfg.xml, I assume it was written from a copy of co_cfg.xml, which contained an error in:

<property name = "addedPrefix" value="CO_321:" / >
# extra space wrong, must be /> to close the tag inline

If this co_wheat_cfg.xml is very similar to co_cfg.xml, consider that an easier way to define it could be importing the latter and then overriding just the bits you need.

I've rebuilt and deployed everything. Please, close this after verifying it's fixed.

KeywanHP commented 3 years ago

Thanks the error is gone but the co_cfg.xml does not seem to add the CO_321: prefix to accessions. Have you tested if it works for you? image

marco-brandizi commented 3 years ago

For the purpose of leaving a record, I'll copy-paste what already discussed in the chat:

Have a look: http://www.cropontology.org/rdf/CO_321:0000088

It doesn't define anything about accessions (don't remember if it used to). The only accession the parser can provide is the one built from the URI, so it yields 0000088, to which the source ID is prefixed, ie, CO.

A quick solution might be that, in dataSourcePrototype, you use the CO_321 ID for the data source, but I don't remember if CO as data source is referred elsewhere.

The IRI-to-accession mapper at the moment doesn't support prefix transformations (as in idAccMapper), we have never needed it.

marco-brandizi commented 2 years ago

@KeywanHP don't remember if we fixed this somehow.

marco-brandizi commented 2 years ago

Closing, reopen if it needs more.