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

Unresolvable circular dependencies #694

Closed
ialarmedalien opened this issue Aug 2, 2022 · 3 comments · Fixed by #706
Closed

Unresolvable circular dependencies #694

ialarmedalien opened this issue Aug 2, 2022 · 3 comments · Fixed by #706

Comments

@ialarmedalien
Copy link

ialarmedalien commented Aug 2, 2022

Schema source: https://gitlab.com/crossref/schema (checked out locally at other_schema/crossref).

There are a couple of different schemas in the repo that I'm looking at, but anything that includes the mathml3.xsd fails to generate the appropriate models.

e.g.

> xsdata other_schema/crossref/schemas/standard-modules/mathml3/mathml3.xsd --package crossref --structure-style namespaces

generates the error (stack trace edited for brevity)

  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/toposort.py", line 84, in toposort
    raise CircularDependencyError(data)
toposort.CircularDependencyError: Circular dependencies exist among these items: {'{http://www.w3.org/1998/Math/MathML}ImpliedMrow':{'{http://www.w3.org/1998/Math/MathML}mrow', ... '{http://www.w3.org/1998/Math/MathML}mover'}}

(same for single-package and filenames)

> xsdata other_schema/crossref/schemas/standard-modules/mathml3/mathml3.xsd --package crossref --structure-style namespace-clusters

error (stack trace edited for brevity):

  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/xsdata/utils/graphs.py", line 43, in strongly_connected_components
    yield from dfs(vertex)
  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/xsdata/utils/graphs.py", line 29, in dfs
    yield from dfs(w)
  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/xsdata/utils/graphs.py", line 29, in dfs
    yield from dfs(w)
  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/xsdata/utils/graphs.py", line 29, in dfs
    yield from dfs(w)
  [Previous line repeated 1 more time]
  File "/Users/gwg/code/kbase/credit_engine/.venv/lib/python3.10/site-packages/xsdata/utils/graphs.py", line 27, in dfs
    for w in edges[v]:
KeyError: '{http://www.w3.org/1998/Math/MathML}product.class'

(same for clusters)

Can you suggest any way around this problem?

@tefra
Copy link
Owner

tefra commented Aug 3, 2022

wow even single package fails, I ''ll take a look sounds like an interesting case.

@tefra
Copy link
Owner

tefra commented Sep 7, 2022

Hi @ialarmedalien

This one was so hard to troubleshoot but I am glad you reported it, it revealed a few wrong things during the schema processing that no other suite in my samples and w3c-tests demostrated.

I took the liberty to add the crossref suite in the samples repo

https://github.com/tefra/xsdata-samples/tree/master/crossref

The fixes are on master!

fyi: the namespace-clusters, clusters and single-package should work for your case

@ialarmedalien
Copy link
Author

Thank you, that's fantastic!

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

Successfully merging a pull request may close this issue.

2 participants