Skip to content

Commit b4323ab

Browse files
authored
Merge pull request #153 from multimeric/xsd
Support XML Schema Definition Language (XSD) import
2 parents 70fe4eb + 3e0f939 commit b4323ab

File tree

6 files changed

+3393
-1881
lines changed

6 files changed

+3393
-1881
lines changed

poetry.lock

Lines changed: 2668 additions & 1881 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ rdflib = "^7.1.1"
5656
jsonasobj2 = "^1.0.4"
5757
deprecation = "^2.1.0"
5858
numpy = "<2.0"
59+
lxml = "^5.3.0"
5960
pydbml = "^1.1.2"
6061
pyyaml = "^6.0.2"
6162
llm = {version = "^0.21", optional = true}
@@ -68,6 +69,10 @@ sphinx-click = ">=3.1.0"
6869
sphinxcontrib-mermaid = ">=0.9.2"
6970
myst-parser = "*"
7071
jupyter = ">=1.0.0"
72+
lxml-stubs = "^0.5.1"
73+
74+
[tool.poetry.group.llm.dependencies]
75+
llm = ">=0.12"
7176
lxml = ">=4.9.1"
7277
deptry = "^0.23.0"
7378

schema_automator/cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from schema_automator.importers.rdfs_import_engine import RdfsImportEngine
3333
from schema_automator.importers.sql_import_engine import SqlImportEngine
3434
from schema_automator.importers.tabular_import_engine import TableImportEngine
35+
from schema_automator.importers.xsd_import_engine import XsdImportEngine
3536
from schema_automator.utils.schemautils import write_schema
3637
from schema_automator import __version__
3738

@@ -497,6 +498,23 @@ def import_rdfs(rdfsfile: str, output: str, metamodel_mappings: str, schema_name
497498
schema = sie.convert(rdfsfile, name=schema_name, **args)
498499
write_schema(schema, output)
499500

501+
@main.command()
502+
@click.argument('xsd')
503+
@output_option
504+
@schema_name_option
505+
@click.option('--output', '-o', help="Path to saved yaml schema")
506+
def import_xsd(xsd: str, output: str, **kwargs):
507+
"""
508+
Import an XML Schema Definition Language (XSD) schema to LinkML
509+
510+
Example:
511+
512+
schemauto import-xsd schema.xml -o prov.yaml
513+
"""
514+
engine = XsdImportEngine()
515+
schema = engine.convert(xsd, **kwargs)
516+
write_schema(schema, output)
517+
500518
@main.command()
501519
@click.argument('rdffile')
502520
@output_option

schema_automator/importers/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@
33
from schema_automator.importers.dosdp_import_engine import DOSDPImportEngine
44
from schema_automator.importers.frictionless_import_engine import FrictionlessImportEngine
55
from schema_automator.importers.cadsr_import_engine import CADSRImportEngine
6+
from schema_automator.importers.xsd_import_engine import XsdImportEngine
7+
8+
__all__ = [
9+
'JsonSchemaImportEngine',
10+
'OwlImportEngine',
11+
'DOSDPImportEngine',
12+
'FrictionlessImportEngine',
13+
'CADSRImportEngine',
14+
'XsdImportEngine'
15+
]

0 commit comments

Comments
 (0)