pyMetaModel 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/PKG-INFO +1 -1
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.sidif +7 -7
- pymetamodel-0.4.2/meta/__init__.py +1 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/metamodel.py +64 -16
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/version.py +1 -1
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_mw.py +4 -3
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_sidif.py +40 -9
- pymetamodel-0.4.0/meta/__init__.py +0 -1
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/.github/workflows/build.yml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/.github/workflows/upload-to-pypi.yml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/.gitignore +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/.project +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/.pydevproject +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/LICENSE +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/README.md +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/docs/index.md +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/ceur-ws/ceur-ws_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/city/city_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/family/FamilyContext_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/infrastructure/infrastructure_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/metamodel/metamodel_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.mermaid +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.sidif +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.xlsx +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema.yaml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/teaching/TeachingSchema_puml.txt +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/metamodel_cmd.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/mw.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/profiler.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/sidif2linkml.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/smw_type.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/meta/uml.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/metamodel.puml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/mkdocs.yml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/pyproject.toml +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/blackisort +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/doc +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/genexamples +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/install +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/release +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/scripts/test +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/__init__.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/basemwtest.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/basetest.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_generators.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_linkml.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_metamodel.py +0 -0
- {pymetamodel-0.4.0 → pymetamodel-0.4.2}/tests/test_plantuml.py +0 -0
|
@@ -215,7 +215,7 @@ Computer_os isA Property
|
|
|
215
215
|
"os" is name of it
|
|
216
216
|
"os" is label of it
|
|
217
217
|
"Text" is type of it
|
|
218
|
-
|
|
218
|
+
1 is index of it
|
|
219
219
|
"The operating system of the computer" is documentation of it
|
|
220
220
|
false is isLink of it
|
|
221
221
|
"Computer" is topic of it
|
|
@@ -225,7 +225,7 @@ Computer_osversion isA Property
|
|
|
225
225
|
"osversion" is name of it
|
|
226
226
|
"osversion" is label of it
|
|
227
227
|
"Text" is type of it
|
|
228
|
-
|
|
228
|
+
2 is index of it
|
|
229
229
|
false is primaryKey of it
|
|
230
230
|
false is mandatory of it
|
|
231
231
|
false is uploadable of it
|
|
@@ -239,7 +239,7 @@ Computer_vm isA Property
|
|
|
239
239
|
"vm" is name of it
|
|
240
240
|
"vm" is label of it
|
|
241
241
|
"Text" is type of it
|
|
242
|
-
|
|
242
|
+
3 is index of it
|
|
243
243
|
false is primaryKey of it
|
|
244
244
|
false is mandatory of it
|
|
245
245
|
false is uploadable of it
|
|
@@ -270,7 +270,7 @@ Harddisk_size isA Property
|
|
|
270
270
|
"size" is name of it
|
|
271
271
|
"size" is label of it
|
|
272
272
|
"Number" is type of it
|
|
273
|
-
|
|
273
|
+
1 is index of it
|
|
274
274
|
false is primaryKey of it
|
|
275
275
|
false is mandatory of it
|
|
276
276
|
false is uploadable of it
|
|
@@ -284,7 +284,7 @@ Harddisk_formfactor isA Property
|
|
|
284
284
|
"formfactor" is name of it
|
|
285
285
|
"formfactor" is label of it
|
|
286
286
|
"Text" is type of it
|
|
287
|
-
|
|
287
|
+
2 is index of it
|
|
288
288
|
false is primaryKey of it
|
|
289
289
|
false is mandatory of it
|
|
290
290
|
false is uploadable of it
|
|
@@ -300,7 +300,7 @@ Harddisk_rpm isA Property
|
|
|
300
300
|
"rpm" is name of it
|
|
301
301
|
"rpm" is label of it
|
|
302
302
|
"Text" is type of it
|
|
303
|
-
|
|
303
|
+
3 is index of it
|
|
304
304
|
false is primaryKey of it
|
|
305
305
|
false is mandatory of it
|
|
306
306
|
false is uploadable of it
|
|
@@ -329,7 +329,7 @@ Monitor_resolution isA Property
|
|
|
329
329
|
"resolution" is name of it
|
|
330
330
|
"resolution" is label of it
|
|
331
331
|
"Text" is type of it
|
|
332
|
-
|
|
332
|
+
1 is index of it
|
|
333
333
|
true is mandatory of it
|
|
334
334
|
"The display resolution of the monitor (e.g., 1920x1080)" is documentation of it
|
|
335
335
|
true is showInGrid of it
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.2"
|
|
@@ -372,7 +372,6 @@ class Topic(MetaModelElement):
|
|
|
372
372
|
self.sourceTopicLinks = {}
|
|
373
373
|
self.targetTopicLinks = {}
|
|
374
374
|
|
|
375
|
-
|
|
376
375
|
def get_extends_topics(self, l: List['Topic'] = None) -> List['Topic']:
|
|
377
376
|
"""
|
|
378
377
|
Get the topics this topic is extending.
|
|
@@ -397,13 +396,33 @@ class Topic(MetaModelElement):
|
|
|
397
396
|
|
|
398
397
|
return l
|
|
399
398
|
|
|
399
|
+
def get_all_properties(self) -> List['Property']:
|
|
400
|
+
"""
|
|
401
|
+
Get all properties of the topic, including those inherited from extended topics.
|
|
402
|
+
|
|
403
|
+
Returns:
|
|
404
|
+
List[Property]: A list of all properties, including inherited ones.
|
|
405
|
+
"""
|
|
406
|
+
all_properties = list(self.properties.values())
|
|
407
|
+
|
|
408
|
+
# Get extended topics
|
|
409
|
+
extended_topics = self.get_extends_topics()
|
|
410
|
+
|
|
411
|
+
# Add properties from extended topics
|
|
412
|
+
for extended_topic in extended_topics:
|
|
413
|
+
for prop in extended_topic.properties.values():
|
|
414
|
+
if prop.name not in [p.name for p in all_properties]:
|
|
415
|
+
all_properties.append(prop)
|
|
416
|
+
|
|
417
|
+
return all_properties
|
|
418
|
+
|
|
400
419
|
|
|
401
420
|
def sanitize(self):
|
|
402
421
|
"""
|
|
403
422
|
make sure my properties exist
|
|
404
423
|
"""
|
|
405
|
-
doc=self.documentation if hasattr(
|
|
406
|
-
if not hasattr(self, "wikiDocumentation"):
|
|
424
|
+
doc=self.documentation if hasattr(self, "documentation") else "?"
|
|
425
|
+
if not hasattr(self, "wikiDocumentation") or not self.wikiDocumentation:
|
|
407
426
|
self.wikiDocumentation=doc
|
|
408
427
|
if not hasattr(self,"defaultstoremode"):
|
|
409
428
|
self.defaultstoremode="property"
|
|
@@ -431,7 +450,8 @@ class Topic(MetaModelElement):
|
|
|
431
450
|
set my concept property to any primary key or mandatory property
|
|
432
451
|
"""
|
|
433
452
|
self.conceptProperty = None
|
|
434
|
-
|
|
453
|
+
all_properties=self.propertiesByIndex(to_root=True)
|
|
454
|
+
for prop in all_properties:
|
|
435
455
|
mandatory = False
|
|
436
456
|
primaryKey = False
|
|
437
457
|
if hasattr(prop, "mandatory"):
|
|
@@ -488,7 +508,8 @@ class Topic(MetaModelElement):
|
|
|
488
508
|
list: a list of properties in sort order
|
|
489
509
|
"""
|
|
490
510
|
prop_list = []
|
|
491
|
-
|
|
511
|
+
all_properties=self.get_all_properties()
|
|
512
|
+
for prop in all_properties:
|
|
492
513
|
if hasattr(prop, "sortPos"):
|
|
493
514
|
sortPos = prop.sortPos
|
|
494
515
|
if sortPos:
|
|
@@ -496,22 +517,48 @@ class Topic(MetaModelElement):
|
|
|
496
517
|
prop_list = sorted(prop_list, key=lambda prop: prop.sortPos)
|
|
497
518
|
return prop_list
|
|
498
519
|
|
|
499
|
-
def
|
|
520
|
+
def propertiesDict(self) -> dict:
|
|
500
521
|
"""
|
|
501
|
-
|
|
522
|
+
Return a dictionary mapping topic names to lists of properties,
|
|
523
|
+
considering the inheritance chain and sorting properties locally by index.
|
|
502
524
|
|
|
503
525
|
Returns:
|
|
504
|
-
|
|
526
|
+
dict: A dictionary with topic names as keys and sorted lists of properties as values.
|
|
505
527
|
"""
|
|
528
|
+
properties_dict = {}
|
|
529
|
+
inheritance_chain = self.get_extends_topics()
|
|
530
|
+
inheritance_chain.append(self)
|
|
531
|
+
for topic in inheritance_chain:
|
|
532
|
+
sorted_props=topic.propertiesByIndex(to_root=False)
|
|
533
|
+
properties_dict[topic.name] = sorted_props
|
|
506
534
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
535
|
+
return properties_dict
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def propertiesByIndex(self,to_root:bool=False) -> list:
|
|
539
|
+
"""
|
|
540
|
+
Return the properties by index, considering inheritance chain.
|
|
541
|
+
|
|
542
|
+
Args:
|
|
543
|
+
to_root(bool): if True follow the inheritance chain to the root
|
|
544
|
+
|
|
545
|
+
Returns:
|
|
546
|
+
list: The list of properties sorted by index,
|
|
547
|
+
with inheritance considered.
|
|
548
|
+
"""
|
|
549
|
+
if to_root:
|
|
550
|
+
sorted_props = []
|
|
551
|
+
for _topic_name, props in self.propertiesDict().items():
|
|
552
|
+
sorted_props.extend(props)
|
|
553
|
+
else:
|
|
554
|
+
props = list(self.properties.values())
|
|
555
|
+
props_count = len(props)
|
|
556
|
+
|
|
557
|
+
# Sort properties locally by index
|
|
558
|
+
sorted_props = sorted(props, key=lambda p: getattr(p, 'index', props_count))
|
|
559
|
+
|
|
560
|
+
return sorted_props
|
|
512
561
|
|
|
513
|
-
prop_list = sorted(self.properties.values(), key=lambda prop: index(prop))
|
|
514
|
-
return prop_list
|
|
515
562
|
|
|
516
563
|
def askSort(self) -> str:
|
|
517
564
|
"""
|
|
@@ -560,7 +607,8 @@ class Topic(MetaModelElement):
|
|
|
560
607
|
markup = f"""{{{{#ask: [[Concept:{self.name}]]
|
|
561
608
|
|mainlabel={mainlabel}
|
|
562
609
|
"""
|
|
563
|
-
|
|
610
|
+
all_properties=self.get_all_properties()
|
|
611
|
+
for prop in all_properties:
|
|
564
612
|
if filterShowInGrid and hasattr(prop, "showInGrid"):
|
|
565
613
|
show = prop.showInGrid
|
|
566
614
|
else:
|
|
@@ -16,7 +16,7 @@ class Version(object):
|
|
|
16
16
|
description = "pyMetaModel: MetaModel for Knowledge Graphs"
|
|
17
17
|
version = meta.__version__
|
|
18
18
|
date = "2022-11-30"
|
|
19
|
-
updated = "2024-08-
|
|
19
|
+
updated = "2024-08-05"
|
|
20
20
|
authors = "Wolfgang Fahl"
|
|
21
21
|
doc_url = "https://wiki.bitplan.com/index.php/pyMetaModel"
|
|
22
22
|
chat_url = "https://github.com/WolfgangFahl/pyMetaModel/discussions"
|
|
@@ -58,7 +58,7 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
58
58
|
"""
|
|
59
59
|
mw_contexts = self.check_contexts(wikiId)
|
|
60
60
|
mw_context = mw_contexts[context_name]
|
|
61
|
-
context, error,
|
|
61
|
+
context, error, _errMsg = Context.fromWikiContext(mw_context, debug=debug)
|
|
62
62
|
self.assertIsNone(error)
|
|
63
63
|
return context
|
|
64
64
|
|
|
@@ -98,12 +98,13 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
98
98
|
test the properties by Index access
|
|
99
99
|
"""
|
|
100
100
|
debug = self.debug
|
|
101
|
+
#debug=True
|
|
101
102
|
context = self.getContext(debug=debug)
|
|
102
103
|
topic = context.topics["Topic"]
|
|
103
104
|
props = topic.propertiesByIndex()
|
|
104
105
|
if debug:
|
|
105
106
|
for prop in props:
|
|
106
|
-
print(f"{prop
|
|
107
|
+
print(f"{getattr(prop,'index','?')}:{prop.name}")
|
|
107
108
|
self.assertEqual(11, len(props))
|
|
108
109
|
self.assertTrue("pluralName", props[1].name)
|
|
109
110
|
|
|
@@ -112,7 +113,7 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
112
113
|
test creating the ask query for a topic
|
|
113
114
|
"""
|
|
114
115
|
debug = self.debug
|
|
115
|
-
debug = True
|
|
116
|
+
#debug = True
|
|
116
117
|
context = self.getContext(debug=debug)
|
|
117
118
|
topic = context.topics["Property"]
|
|
118
119
|
ask_query = topic.askQuery()
|
|
@@ -3,6 +3,7 @@ Created on 2023-02-25
|
|
|
3
3
|
|
|
4
4
|
@author: wf
|
|
5
5
|
"""
|
|
6
|
+
import json
|
|
6
7
|
import os
|
|
7
8
|
from meta.metamodel import Context
|
|
8
9
|
from tests.basetest import Basetest
|
|
@@ -12,7 +13,7 @@ class TestSiDIF(Basetest):
|
|
|
12
13
|
"""
|
|
13
14
|
test SiDIF handling
|
|
14
15
|
"""
|
|
15
|
-
def setUp(self, debug=
|
|
16
|
+
def setUp(self, debug=False, profile=True):
|
|
16
17
|
Basetest.setUp(self, debug=debug, profile=profile)
|
|
17
18
|
self.examples_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "examples")
|
|
18
19
|
|
|
@@ -55,27 +56,48 @@ class TestSiDIF(Basetest):
|
|
|
55
56
|
with self.subTest(file=file):
|
|
56
57
|
self.check_sidif(sidif_path,file)
|
|
57
58
|
|
|
59
|
+
|
|
60
|
+
def test_properties_by_index(self):
|
|
61
|
+
"""
|
|
62
|
+
test the properties by index handling
|
|
63
|
+
"""
|
|
64
|
+
sidif_file="infrastructure/infrastructure.sidif"
|
|
65
|
+
sidif_path = os.path.join(self.examples_dir, sidif_file)
|
|
66
|
+
context = self.check_sidif(sidif_path, sidif_file)
|
|
67
|
+
debug=self.debug
|
|
68
|
+
debug=True
|
|
69
|
+
for topic_name,topic in context.topics.items():
|
|
70
|
+
props_dict=topic.propertiesDict()
|
|
71
|
+
if debug:
|
|
72
|
+
print(f"Properties Dict for {topic_name}:{topic.documentation}/{topic.wikiDocumentation}")
|
|
73
|
+
for topic_name,(topic_name,props) in enumerate(props_dict.items()):
|
|
74
|
+
print(f"{topic_name}:")
|
|
75
|
+
for j,prop in enumerate(props):
|
|
76
|
+
print(f" {j:3}:{prop.name} ({getattr(prop,'index','?')})")
|
|
77
|
+
|
|
78
|
+
|
|
58
79
|
def testInheritance(self):
|
|
59
80
|
"""
|
|
60
81
|
test inheritance
|
|
61
82
|
"""
|
|
62
83
|
for sidif_file,topics in {
|
|
63
84
|
"infrastructure/infrastructure.sidif": [
|
|
64
|
-
("Computer",["Device"]),
|
|
65
|
-
("Monitor",["Device"]),
|
|
66
|
-
("Printer",["Device"])
|
|
85
|
+
("Computer","name",["Device"]),
|
|
86
|
+
("Monitor","name",["Device"]),
|
|
87
|
+
("Printer","name",["Device"])
|
|
67
88
|
],
|
|
68
89
|
"scientific-events/scientific-events.sidif":
|
|
69
|
-
[("Event", ["WebWdItem","WikidataItem"]),
|
|
70
|
-
("Country",["WebWdItem","WikidataItem"]),
|
|
71
|
-
("Region" ,["WikidataItem"]),
|
|
72
|
-
("Scholar",["WebWdItem","WikidataItem"]),
|
|
90
|
+
[("Event", "name",["WebWdItem","WikidataItem"]),
|
|
91
|
+
("Country","name",["WebWdItem","WikidataItem"]),
|
|
92
|
+
("Region" ,"name",["WikidataItem"]),
|
|
93
|
+
("Scholar","name",["WebWdItem","WikidataItem"]),
|
|
73
94
|
],
|
|
74
95
|
}.items():
|
|
75
96
|
sidif_path = os.path.join(self.examples_dir, sidif_file)
|
|
76
97
|
context = self.check_sidif(sidif_path, sidif_file)
|
|
77
98
|
debug=self.debug
|
|
78
|
-
|
|
99
|
+
#debug=True
|
|
100
|
+
for topic_name,concept_property_name,extends_list in topics:
|
|
79
101
|
self.assertIn(topic_name, context.topics, f"Topic {topic_name} not found in {sidif_file}")
|
|
80
102
|
topic = context.topics[topic_name]
|
|
81
103
|
self.assertTrue(hasattr(topic, 'extends'), f"Topic {topic_name} in {sidif_file} does not have 'extends' attribute")
|
|
@@ -88,7 +110,16 @@ class TestSiDIF(Basetest):
|
|
|
88
110
|
if debug:
|
|
89
111
|
print(f"{i+1}:{extends_topic.name}={expected}?")
|
|
90
112
|
self.assertEqual(extends_topic.name,expected)
|
|
113
|
+
props_by_index=topic.propertiesByIndex(to_root=True)
|
|
114
|
+
if debug:
|
|
115
|
+
for i,prop in enumerate(props_by_index):
|
|
116
|
+
print(f"{i:3}:{prop.name} ({getattr(prop,'index','?')})")
|
|
117
|
+
self.assertTrue(topic.conceptProperty is not None,topic.name)
|
|
118
|
+
if self.debug:
|
|
119
|
+
print(f"{topic_name}.{topic.conceptProperty.name} is concept property")
|
|
120
|
+
self.assertEqual(concept_property_name,topic.conceptProperty.name,topic.name)
|
|
91
121
|
|
|
122
|
+
pass
|
|
92
123
|
pass
|
|
93
124
|
|
|
94
125
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events.mermaid
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymetamodel-0.4.0 → pymetamodel-0.4.2}/examples/scientific-events/scientific-events_puml.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|