Skip to content

Commit

Permalink
attempt to upgrade to linkml 1.7 compatibility, mimicing docgen's int…
Browse files Browse the repository at this point in the history
…eraction with generator superclass
  • Loading branch information
kevinschaper committed May 24, 2024
1 parent 5fc6356 commit 2082254
Show file tree
Hide file tree
Showing 4 changed files with 866 additions and 965 deletions.
2 changes: 1 addition & 1 deletion linkml_solr/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def load_schema(self, dry_run: bool = False) -> SolrSchemaGenerator:
'name': 'date',
'class': 'solr.TrieDateField',
}}, path='schema')
gen = SolrSchemaGenerator(self.schema, top_class=self.top_class)
gen = SolrSchemaGenerator(self.schema)
gen.serialize()
post_obj = gen.post_request
for f in post_obj['add-field']:
Expand Down
10 changes: 7 additions & 3 deletions linkml_solr/solrschemagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,25 @@ class SolrSchemaGenerator(Generator):
generatorname = os.path.basename(__file__)
generatorversion = "0.0.1"
valid_formats = ["json"]
uses_schemaloader = False
visit_all_class_slots = True
transaction: Transaction = None
schemaview: SchemaView = None
topCls: str = None

def __init__(self, schema: Union[str, TextIO, SchemaDefinition], top_class: Optional[str] = None, **kwargs) -> None:
super().__init__(schema, **kwargs)
# def __init__(self, schema: Union[str, TextIO, SchemaDefinition], top_class: Optional[str] = None, **kwargs) -> None:
def __post_init__(self):
# super().__init__(schema, **kwargs)
#self.schema = schema
self.transaction = Transaction()
self.post_request = None
self.inline = False
self.topCls = top_class ## SOLR object is one instance of this
# self.topCls = top_class ## SOLR object is one instance of this
self.entryProperties = {}
# SOLR-Schema does not have inheritance,
# so we duplicate slots from inherited parents and mixins
self.visit_all_slots = True
super().__post_init__()
self.schemaview = SchemaView(self.schema)

def _transaction_json(self, transaction: Transaction) -> str:
Expand Down
Loading

0 comments on commit 2082254

Please sign in to comment.