pyMetaModel 0.4.2__tar.gz → 0.4.3__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.2 → pymetamodel-0.4.3}/PKG-INFO +1 -1
- pymetamodel-0.4.3/meta/__init__.py +1 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/metamodel.py +11 -10
- pymetamodel-0.4.3/tests/basesmwtest.py +70 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_mw.py +40 -88
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_sidif.py +1 -2
- pymetamodel-0.4.2/meta/__init__.py +0 -1
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/.github/workflows/build.yml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/.github/workflows/upload-to-pypi.yml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/.gitignore +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/.project +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/.pydevproject +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/LICENSE +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/README.md +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/docs/index.md +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/ceur-ws/ceur-ws_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/city/city_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/family/FamilyContext_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/infrastructure/infrastructure_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/metamodel/metamodel_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/scientific-events/scientific-events_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.mermaid +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.sidif +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.xlsx +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema.yaml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/examples/teaching/TeachingSchema_puml.txt +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/metamodel_cmd.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/mw.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/profiler.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/sidif2linkml.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/smw_type.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/uml.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/meta/version.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/metamodel.puml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/mkdocs.yml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/pyproject.toml +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/blackisort +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/doc +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/genexamples +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/install +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/release +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/scripts/test +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/__init__.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/basemwtest.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/basetest.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_generators.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_linkml.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_metamodel.py +0 -0
- {pymetamodel-0.4.2 → pymetamodel-0.4.3}/tests/test_plantuml.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.3"
|
|
@@ -591,7 +591,7 @@ class Topic(MetaModelElement):
|
|
|
591
591
|
listLimit: int = None,
|
|
592
592
|
) -> str:
|
|
593
593
|
"""
|
|
594
|
-
|
|
594
|
+
Get the askQuery for the topic, considering inheritance.
|
|
595
595
|
|
|
596
596
|
Args:
|
|
597
597
|
mainlabel (str): the mainlabel to use - topic.name as default
|
|
@@ -607,19 +607,20 @@ class Topic(MetaModelElement):
|
|
|
607
607
|
markup = f"""{{{{#ask: [[Concept:{self.name}]]
|
|
608
608
|
|mainlabel={mainlabel}
|
|
609
609
|
"""
|
|
610
|
-
|
|
611
|
-
for
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
610
|
+
properties_dict = self.propertiesDict()
|
|
611
|
+
for topic_name, properties in properties_dict.items():
|
|
612
|
+
for prop in properties:
|
|
613
|
+
if filterShowInGrid:
|
|
614
|
+
show=getattr(prop, "showInGrid",False)
|
|
615
|
+
else:
|
|
616
|
+
show = True
|
|
617
|
+
if show:
|
|
618
|
+
# Use the topic_name as prefix, which will be correct for inherited properties
|
|
619
|
+
markup += f"|?{topic_name} {prop.name} = {prop.name}\n"
|
|
618
620
|
markup += f"|limit={listLimit}\n"
|
|
619
621
|
markup += f"""{self.askSort()}}}}}"""
|
|
620
622
|
return markup
|
|
621
623
|
|
|
622
|
-
|
|
623
624
|
class Property(MetaModelElement):
|
|
624
625
|
"""
|
|
625
626
|
Provides helper functions and constants for properties
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Created on 18.01.2023
|
|
3
|
+
|
|
4
|
+
@author: wf
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from typing import List
|
|
10
|
+
|
|
11
|
+
from meta.metamodel import Context
|
|
12
|
+
from meta.mw import SMWAccess
|
|
13
|
+
|
|
14
|
+
from tests.basemwtest import BaseMediawikiTest
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ContextContext:
|
|
18
|
+
|
|
19
|
+
def __init__(self, smwAccess: SMWAccess, context: Context, debug: bool = False):
|
|
20
|
+
self.smwAccess = smwAccess
|
|
21
|
+
self.context = context
|
|
22
|
+
self.debug = debug
|
|
23
|
+
|
|
24
|
+
debug: bool = False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BaseSemanticMediawikiTest(BaseMediawikiTest):
|
|
28
|
+
"""
|
|
29
|
+
special semantic mediawiki tests
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def setUp(self, debug=False, profile=True):
|
|
33
|
+
BaseMediawikiTest.setUp(self, debug=debug, profile=profile)
|
|
34
|
+
|
|
35
|
+
def check_contexts(self, wikiId: str, ignoreExceptions: bool = True):
|
|
36
|
+
"""
|
|
37
|
+
check the mediawiki contexts for the given wikiId
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
wikiId(str): the wikiId to check
|
|
41
|
+
ignoreExceptions(bool): if True only print out a warning other wise raise exception
|
|
42
|
+
"""
|
|
43
|
+
mw_contexts = {}
|
|
44
|
+
smwAccess=None
|
|
45
|
+
try:
|
|
46
|
+
smwAccess = SMWAccess(wikiId, debug=self.debug)
|
|
47
|
+
mw_contexts = smwAccess.getMwContexts()
|
|
48
|
+
if self.debug:
|
|
49
|
+
for name, mw_context in mw_contexts.items():
|
|
50
|
+
print(f"{name}: {mw_context.sidif_url()}")
|
|
51
|
+
print(f"found {len(mw_contexts)} Contexts")
|
|
52
|
+
except Exception as ex:
|
|
53
|
+
print(
|
|
54
|
+
f"warning Mediawiki context for {wikiId} fetching failed due to {str(ex)}",
|
|
55
|
+
file=sys.stderr,
|
|
56
|
+
)
|
|
57
|
+
if not ignoreExceptions:
|
|
58
|
+
raise ex
|
|
59
|
+
return smwAccess, mw_contexts
|
|
60
|
+
|
|
61
|
+
def getContextContext(self, wikiId: str = "wiki", context_name: str = "MetaModel"):
|
|
62
|
+
"""
|
|
63
|
+
get the default meta model context
|
|
64
|
+
"""
|
|
65
|
+
smwAccess, mw_contexts = self.check_contexts(wikiId)
|
|
66
|
+
mw_context = mw_contexts[context_name]
|
|
67
|
+
context, error, _errMsg = Context.fromWikiContext(mw_context, debug=self.debug)
|
|
68
|
+
self.assertIsNone(error)
|
|
69
|
+
cc = ContextContext(smwAccess, context)
|
|
70
|
+
return cc
|
|
@@ -5,15 +5,14 @@ Created on 2022-11-23
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
|
-
import sys
|
|
9
8
|
|
|
10
9
|
from wikibot3rd.wikiuser import WikiUser
|
|
11
10
|
|
|
12
11
|
from meta.metamodel import Context
|
|
13
|
-
from tests.
|
|
12
|
+
from tests.basesmwtest import BaseSemanticMediawikiTest
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
class TestMediawiki(
|
|
15
|
+
class TestMediawiki(BaseSemanticMediawikiTest):
|
|
17
16
|
"""
|
|
18
17
|
test reading SiDIF from Mediawiki pages
|
|
19
18
|
"""
|
|
@@ -22,60 +21,24 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
22
21
|
"""
|
|
23
22
|
setUp
|
|
24
23
|
"""
|
|
25
|
-
|
|
24
|
+
BaseSemanticMediawikiTest.setUp(self, debug=debug, profile=profile)
|
|
26
25
|
for wikiId in ["wiki", "royals", "cr"]:
|
|
27
26
|
self.getSMWAccess(wikiId, save=True)
|
|
28
27
|
|
|
29
|
-
def check_contexts(self, wikiId: str, ignoreExceptions: bool = True):
|
|
30
|
-
"""
|
|
31
|
-
check the mediawiki contexts for the given wikiId
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
wikiId(str): the wikiId to check
|
|
35
|
-
ignoreExceptions(bool): if True only print out a warning other wise raise exception
|
|
36
|
-
"""
|
|
37
|
-
mw_contexts = {}
|
|
38
|
-
try:
|
|
39
|
-
smwAccess = self.smwAccessMap[wikiId]
|
|
40
|
-
mw_contexts = smwAccess.getMwContexts()
|
|
41
|
-
for name, mw_context in mw_contexts.items():
|
|
42
|
-
print(f"{name}: {mw_context.sidif_url()}")
|
|
43
|
-
print(f"found {len(mw_contexts)} Contexts")
|
|
44
|
-
except Exception as ex:
|
|
45
|
-
print(
|
|
46
|
-
f"warning Mediawiki context for {wikiId} fetching failed due to {str(ex)}",
|
|
47
|
-
file=sys.stderr,
|
|
48
|
-
)
|
|
49
|
-
if not ignoreExceptions:
|
|
50
|
-
raise ex
|
|
51
|
-
return mw_contexts
|
|
52
|
-
|
|
53
|
-
def getContext(
|
|
54
|
-
self, wikiId: str = "wiki", context_name: str = "MetaModel", debug: bool = False
|
|
55
|
-
):
|
|
56
|
-
"""
|
|
57
|
-
get the default meta model context
|
|
58
|
-
"""
|
|
59
|
-
mw_contexts = self.check_contexts(wikiId)
|
|
60
|
-
mw_context = mw_contexts[context_name]
|
|
61
|
-
context, error, _errMsg = Context.fromWikiContext(mw_context, debug=debug)
|
|
62
|
-
self.assertIsNone(error)
|
|
63
|
-
return context
|
|
64
|
-
|
|
65
28
|
def test_contexts(self):
|
|
66
29
|
"""
|
|
67
30
|
test getting the list of mediawiki contexts
|
|
68
31
|
"""
|
|
69
|
-
mw_contexts = self.check_contexts("wiki")
|
|
32
|
+
_smwAccess, mw_contexts = self.check_contexts("wiki")
|
|
70
33
|
self.assertTrue(len(mw_contexts) >= 15)
|
|
71
34
|
|
|
72
35
|
def test_conceptProperty(self):
|
|
73
36
|
"""
|
|
74
37
|
test the conceptProperty handling
|
|
75
38
|
"""
|
|
76
|
-
debug
|
|
77
|
-
|
|
78
|
-
topic = context.topics["Property"]
|
|
39
|
+
debug=self.debug
|
|
40
|
+
cc = self.getContextContext()
|
|
41
|
+
topic = cc.context.topics["Property"]
|
|
79
42
|
self.assertIsNotNone(topic.conceptProperty)
|
|
80
43
|
if debug:
|
|
81
44
|
print(topic.conceptProperty)
|
|
@@ -85,9 +48,8 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
85
48
|
"""
|
|
86
49
|
test the access to the list of sort properties
|
|
87
50
|
"""
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
topic = context.topics["Property"]
|
|
51
|
+
cc = self.getContextContext()
|
|
52
|
+
topic = cc.context.topics["Property"]
|
|
91
53
|
sorted_props = topic.sortProperties()
|
|
92
54
|
self.assertEqual(1, len(sorted_props))
|
|
93
55
|
sort_prop = sorted_props[0]
|
|
@@ -97,10 +59,9 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
97
59
|
"""
|
|
98
60
|
test the properties by Index access
|
|
99
61
|
"""
|
|
100
|
-
debug
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
topic = context.topics["Topic"]
|
|
62
|
+
debug=self.debug
|
|
63
|
+
cc = self.getContextContext()
|
|
64
|
+
topic = cc.context.topics["Topic"]
|
|
104
65
|
props = topic.propertiesByIndex()
|
|
105
66
|
if debug:
|
|
106
67
|
for prop in props:
|
|
@@ -114,8 +75,8 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
114
75
|
"""
|
|
115
76
|
debug = self.debug
|
|
116
77
|
#debug = True
|
|
117
|
-
|
|
118
|
-
topic = context.topics["Property"]
|
|
78
|
+
cc = self.getContextContext()
|
|
79
|
+
topic = cc.context.topics["Property"]
|
|
119
80
|
ask_query = topic.askQuery()
|
|
120
81
|
if debug:
|
|
121
82
|
print(ask_query)
|
|
@@ -124,36 +85,17 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
124
85
|
"""
|
|
125
86
|
test topic links
|
|
126
87
|
"""
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
city_topic = context.topics["City"]
|
|
88
|
+
cc = self.getContextContext(wikiId="cr", context_name="CrSchema")
|
|
89
|
+
city_topic = cc.context.topics["City"]
|
|
130
90
|
stl = city_topic.sourceTopicLinks
|
|
131
91
|
ttl = city_topic.targetTopicLinks
|
|
132
|
-
debug =
|
|
92
|
+
debug = self.debug
|
|
133
93
|
if debug:
|
|
134
94
|
print(json.dumps(stl, indent=2, default=str))
|
|
135
95
|
print(json.dumps(ttl, indent=2, default=str))
|
|
136
96
|
self.assertEqual(1, len(stl))
|
|
137
97
|
self.assertEqual(1, len(ttl))
|
|
138
98
|
|
|
139
|
-
def test_Issue3(self):
|
|
140
|
-
"""
|
|
141
|
-
https://github.com/WolfgangFahl/pyMetaModel/issues/3
|
|
142
|
-
"""
|
|
143
|
-
return
|
|
144
|
-
debug = True
|
|
145
|
-
wikiUsers = WikiUser.getWikiUsers(lenient=True)
|
|
146
|
-
if "test" in wikiUsers:
|
|
147
|
-
mw_contexts = self.check_contexts("test")
|
|
148
|
-
tc = mw_contexts["Training"]
|
|
149
|
-
context, error, errMsg = Context.fromWikiContext(tc, debug=self.debug)
|
|
150
|
-
self.assertIsNotNone(context)
|
|
151
|
-
self.assertIsNone(error)
|
|
152
|
-
# changed 2022-12-04 since error doesn't happen any more
|
|
153
|
-
# errorMessage=SiDIFParser.errorMessage("Training context parsing error",error)
|
|
154
|
-
# if debug:
|
|
155
|
-
# print(errorMessage)
|
|
156
|
-
# self.assertTrue("property Qualität" in errorMessage)
|
|
157
99
|
|
|
158
100
|
def test_Issue8(self):
|
|
159
101
|
"""
|
|
@@ -163,7 +105,7 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
163
105
|
debug = True
|
|
164
106
|
wikiUsers = WikiUser.getWikiUsers(lenient=True)
|
|
165
107
|
if "wiki" in wikiUsers:
|
|
166
|
-
mw_contexts = self.check_contexts("wiki")
|
|
108
|
+
_smwAccess, mw_contexts = self.check_contexts("wiki")
|
|
167
109
|
mw_context = mw_contexts["OpenSourceProjectsContext"]
|
|
168
110
|
context, error, errMsg = Context.fromWikiContext(mw_context, debug=debug)
|
|
169
111
|
self.assertIsNone(error)
|
|
@@ -176,39 +118,49 @@ class TestMediawiki(BaseMediawikiTest):
|
|
|
176
118
|
https://github.com/WolfgangFahl/pyMetaModel/issues/23
|
|
177
119
|
handle "showInGrid"
|
|
178
120
|
"""
|
|
121
|
+
cc=self.getContextContext(context_name="Infrastructure")
|
|
122
|
+
topic=cc.context.topics["Harddisk"]
|
|
123
|
+
debug=self.debug
|
|
124
|
+
#debug=True
|
|
125
|
+
for filterShowInGrid in [False,True]:
|
|
126
|
+
ask_query = topic.askQuery(filterShowInGrid=filterShowInGrid)
|
|
127
|
+
|
|
128
|
+
if debug:
|
|
129
|
+
print(f"showInGrid: {filterShowInGrid}")
|
|
130
|
+
print(ask_query)
|
|
131
|
+
self.assertTrue("|?Device name = name" in ask_query)
|
|
132
|
+
if filterShowInGrid:
|
|
133
|
+
self.assertFalse("purpose" in ask_query)
|
|
134
|
+
|
|
179
135
|
|
|
180
136
|
def test_metamodel_from_wikis(self):
|
|
181
137
|
"""
|
|
182
138
|
test reading meta models from wikis
|
|
183
139
|
"""
|
|
184
|
-
debug =
|
|
140
|
+
debug = True
|
|
185
141
|
lenient = True
|
|
186
142
|
for wikiId in WikiUser.getWikiUsers(lenient=True):
|
|
187
|
-
mw_contexts = self.check_contexts(wikiId)
|
|
188
|
-
for
|
|
143
|
+
_smwAccess, mw_contexts = self.check_contexts(wikiId)
|
|
144
|
+
for context_name in mw_contexts:
|
|
189
145
|
if debug:
|
|
190
|
-
print(f"reading context {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
146
|
+
print(f"reading context {context_name} from wiki {wikiId}")
|
|
147
|
+
cc = self.getContextContext(wikiId=wikiId, context_name=context_name)
|
|
148
|
+
context = cc.context
|
|
194
149
|
if not lenient:
|
|
195
150
|
self.assertIsNotNone(context)
|
|
196
151
|
else:
|
|
197
152
|
if context is None:
|
|
198
153
|
continue
|
|
199
154
|
if debug:
|
|
200
|
-
print(f"{
|
|
155
|
+
print(f"{context_name} has context {context.name}")
|
|
201
156
|
print(context)
|
|
202
157
|
for _name, topic in context.topics.items():
|
|
203
158
|
print(topic)
|
|
204
159
|
for _name, property in topic.properties.items():
|
|
205
160
|
print(property)
|
|
206
|
-
if error is not None:
|
|
207
|
-
print(error)
|
|
208
161
|
if len(context.errors) > 0:
|
|
209
162
|
for error in context.errors:
|
|
210
163
|
print(error)
|
|
211
164
|
if not lenient:
|
|
212
|
-
self.assertIsNone(error)
|
|
213
165
|
self.assertEqual(0, len(context.errors))
|
|
214
|
-
self.assertEqual(
|
|
166
|
+
self.assertEqual(context_name, context.name, wikiId)
|
|
@@ -3,7 +3,6 @@ Created on 2023-02-25
|
|
|
3
3
|
|
|
4
4
|
@author: wf
|
|
5
5
|
"""
|
|
6
|
-
import json
|
|
7
6
|
import os
|
|
8
7
|
from meta.metamodel import Context
|
|
9
8
|
from tests.basetest import Basetest
|
|
@@ -65,7 +64,7 @@ class TestSiDIF(Basetest):
|
|
|
65
64
|
sidif_path = os.path.join(self.examples_dir, sidif_file)
|
|
66
65
|
context = self.check_sidif(sidif_path, sidif_file)
|
|
67
66
|
debug=self.debug
|
|
68
|
-
debug=True
|
|
67
|
+
#debug=True
|
|
69
68
|
for topic_name,topic in context.topics.items():
|
|
70
69
|
props_dict=topic.propertiesDict()
|
|
71
70
|
if debug:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.2"
|
|
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
|
|
File without changes
|
{pymetamodel-0.4.2 → pymetamodel-0.4.3}/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.2 → pymetamodel-0.4.3}/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
|
|
File without changes
|