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

Error with XSD Schema for common #2

Open
paulo-graca opened this issue Jul 23, 2021 · 0 comments
Open

Error with XSD Schema for common #2

paulo-graca opened this issue Jul 23, 2021 · 0 comments

Comments

@paulo-graca
Copy link

Hi Dimitris, this isn't probably the best place for me to put this issue. But perhaps you can forward it to the responsible persons.

Basically, to overcome the need of specifying in POJO (Plain Old Java Objects) classes manually the model (#1 ), I opted to use JAXB and XJC to extract classes from the main XSD - https://www.openaire.eu/schema/1.0/oaf-1.0.xsd.

But I had an issue extracting it:

parsing a schema...
[ERROR] Property "ClassId" is already defined. Use <jaxb:property> to resolve this conflict.
  line 45 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] The following location is relevant to the above error
  line 45 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] Property "Classname" is already defined. Use <jaxb:property> to resolve this conflict.
  line 46 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] The following location is relevant to the above error
  line 46 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] Property "Schemeid" is already defined. Use <jaxb:property> to resolve this conflict.
  line 47 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] The following location is relevant to the above error
  line 47 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] Property "Schemename" is already defined. Use <jaxb:property> to resolve this conflict.
  line 48 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

[ERROR] The following location is relevant to the above error
  line 48 of file:/mnt/c/Users/pgraca/projects/openaire-funders-jaxb-model/src/main/resources/xsd/1.0/oaf-common-1.0.xsd

Failed to parse a schema.

I initially thought the problem was with bidding. I tried several stuff. But eventually I look into the model and found an issue with with. Basically at oaf-common-1.0.xsd file we have:

	<xs:complexType name="structuredPropertyElementType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attributeGroup ref="qualifierAttributeGroup"/>
				<xs:attributeGroup ref="dataInfoAttributeGroup"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

and

	<xs:attributeGroup name="dataInfoAttributeGroup">
		<xs:attribute name="inferred" use="optional" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>True if this information has been inferred by the automatic
					inference algorithms run by OpenAIRE. </xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="trust" use="optional" type="xs:string">
			<xs:annotation>
				<xs:documentation>Value of trust of this information in the range [0,1]. More the
					value, more trustworthy is the information. </xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="inferenceprovenance" use="optional" type="xs:string">
			<xs:annotation>
				<xs:documentation>Which algorithm inferred the current property. </xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attributeGroup ref="qualifierAttributeGroup"></xs:attributeGroup>
	</xs:attributeGroup>

But if we look into it closely we will find that dataInfoAttributeGroup already uses qualifierAttributeGroup, so it this definition we are creating some kind of loop. And that explained my errors. I simply removed the <xs:attributeGroup ref="qualifierAttributeGroup"/> and I was able to generate my POJO's classes. Having:

	<xs:complexType name="structuredPropertyElementType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attributeGroup ref="dataInfoAttributeGroup"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

Could you bring this to the people that define the schema, please?

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

No branches or pull requests

1 participant