pyMetaModel 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
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.
- meta/__init__.py +1 -1
- meta/metamodel.py +45 -0
- meta/metamodel_cmd.py +2 -1
- meta/smw_type.py +49 -0
- {pymetamodel-0.2.2.dist-info → pymetamodel-0.2.4.dist-info}/METADATA +2 -1
- pymetamodel-0.2.4.dist-info/RECORD +14 -0
- pymetamodel-0.2.2.dist-info/RECORD +0 -13
- {pymetamodel-0.2.2.dist-info → pymetamodel-0.2.4.dist-info}/WHEEL +0 -0
- {pymetamodel-0.2.2.dist-info → pymetamodel-0.2.4.dist-info}/entry_points.txt +0 -0
- {pymetamodel-0.2.2.dist-info → pymetamodel-0.2.4.dist-info}/licenses/LICENSE +0 -0
meta/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.4"
|
meta/metamodel.py
CHANGED
|
@@ -376,6 +376,51 @@ class Topic(MetaModelElement):
|
|
|
376
376
|
return sys.maxsize
|
|
377
377
|
prop_list=sorted(self.properties.values(),key=lambda prop:index(prop))
|
|
378
378
|
return prop_list
|
|
379
|
+
|
|
380
|
+
def askSort(self)->str:
|
|
381
|
+
"""
|
|
382
|
+
generate the sort clause for my SMW ask query
|
|
383
|
+
|
|
384
|
+
Returns:
|
|
385
|
+
str: the generated wiki markup
|
|
386
|
+
"""
|
|
387
|
+
sort=""
|
|
388
|
+
order=""
|
|
389
|
+
delim=""
|
|
390
|
+
sortproperties=self.sortProperties()
|
|
391
|
+
for prop in sortproperties:
|
|
392
|
+
direction="ascending" if getattr(prop,"sortAscending",True) else "descending"
|
|
393
|
+
sort+=delim+f"{self.name} {prop.name}"
|
|
394
|
+
order+=delim+direction
|
|
395
|
+
delim=","
|
|
396
|
+
pass
|
|
397
|
+
sortClause=f"|sort={sort}\n" if sort else ""
|
|
398
|
+
orderClause=f"|order={order}\n" if order else ""
|
|
399
|
+
markup=f"{sortClause}{orderClause}"
|
|
400
|
+
return markup
|
|
401
|
+
|
|
402
|
+
def askQuery(self,mainlabel:str=None,listLimit:int=None)->str:
|
|
403
|
+
"""
|
|
404
|
+
get the askQuery for the me topic
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
mainlabel(str): the mainlabel to use - topic.name as default
|
|
408
|
+
listLimit(int): the list limit to use
|
|
409
|
+
Returns:
|
|
410
|
+
str: the markup for the query
|
|
411
|
+
"""
|
|
412
|
+
if listLimit is None:
|
|
413
|
+
listLimit=self.getListLimit()
|
|
414
|
+
if mainlabel is None:
|
|
415
|
+
mainlabel=self.name
|
|
416
|
+
markup=f"""{{{{#ask: [[Concept:{self.name}]]
|
|
417
|
+
|mainlabel={mainlabel}
|
|
418
|
+
"""
|
|
419
|
+
for prop in self.properties.values():
|
|
420
|
+
markup+=f"|?{self.name} {prop.name} = {prop.name}\n"
|
|
421
|
+
markup+=f"| limit={listLimit}\n"
|
|
422
|
+
markup+=f"""{self.askSort()}}}}}"""
|
|
423
|
+
return markup
|
|
379
424
|
|
|
380
425
|
|
|
381
426
|
class Property(MetaModelElement):
|
meta/metamodel_cmd.py
CHANGED
|
@@ -71,7 +71,8 @@ class MetaModelCmd:
|
|
|
71
71
|
args(Args): command line arguments
|
|
72
72
|
"""
|
|
73
73
|
if args.input:
|
|
74
|
-
|
|
74
|
+
result_tuple=Context.fromSiDIF_input(args.input,debug=args.debug)
|
|
75
|
+
self.context,self.error,self.errMsg=result_tuple
|
|
75
76
|
elif args.wikiId and args.context:
|
|
76
77
|
self.wikiId=args.wikiId
|
|
77
78
|
self.smwAccess=SMWAccess(args.wikiId)
|
meta/smw_type.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
import dacite
|
|
4
|
+
@dataclass
|
|
5
|
+
class SMW_Type:
|
|
6
|
+
"""
|
|
7
|
+
an SMW_Type is a data type which determines the possible values for that type e.g. a Boolean can hold true/false values while a Number can hold 3.1459 or 20. A Page can hold the name of a Wiki page see https://semantic-mediawiki.org/wiki/Help:List_of_datatypes
|
|
8
|
+
"""
|
|
9
|
+
pageTitle:str
|
|
10
|
+
type:Optional[str] # The Semantic MediaWiki type without the prefix e.g. Text, Number, Boolean
|
|
11
|
+
documentation:Optional[str] # The documentation of this Semantic Media Wiki type
|
|
12
|
+
id:Optional[str] # SMW internal id of the type
|
|
13
|
+
helppage:Optional[str] # The url of the 'official' documentation page of this type
|
|
14
|
+
typepage:Optional[str] # The Semantic Media Wiki Special page for this specific type e.g. Special:Types/Text, Special:Types/Boolean, Special:Types/Date, Special:Types/Number, Special:Types/Page
|
|
15
|
+
javaType:Optional[str] # Java mapping of this type
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def askQuery(cls):
|
|
19
|
+
"""
|
|
20
|
+
get the ask Query for SMW_Type
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
str: the mediawiki markup for the ask query
|
|
24
|
+
"""
|
|
25
|
+
ask="""{{#ask: [[Concept:SMW_Type]]
|
|
26
|
+
|mainlabel=pageTitle
|
|
27
|
+
|?SMW_Type type = type
|
|
28
|
+
|?SMW_Type documentation = documentation
|
|
29
|
+
|?SMW_Type id = id
|
|
30
|
+
|?SMW_Type helppage = helppage
|
|
31
|
+
|?SMW_Type typepage = typepage
|
|
32
|
+
|?SMW_Type javaType = javaType
|
|
33
|
+
| limit=200
|
|
34
|
+
}}"""
|
|
35
|
+
return ask
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def fromDict(cls,data:dict):
|
|
39
|
+
"""
|
|
40
|
+
create a SMW_Type from the given dict
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
data(dict): the dict to create the SMW_Type from
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
SMW_Type: the freshly created SMW_Type
|
|
47
|
+
"""
|
|
48
|
+
smw_type=dacite.from_dict(data_class=cls,data=data)
|
|
49
|
+
return smw_type
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyMetaModel
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Project-URL: Home, https://github.com/WolfgangFahl/pyMetaModel
|
|
5
5
|
Project-URL: Documentation, https://wiki.bitplan.com/index.php/PyMetaModel
|
|
6
6
|
Project-URL: Source, https://github.com/WolfgangFahl/pyMetaModel
|
|
@@ -221,6 +221,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
221
221
|
Classifier: Programming Language :: Python :: 3.11
|
|
222
222
|
Classifier: Topic :: Software Development
|
|
223
223
|
Requires-Python: >=3.8
|
|
224
|
+
Requires-Dist: dacite>=1.7.0
|
|
224
225
|
Requires-Dist: linkml-runtime>=1.4.5
|
|
225
226
|
Requires-Dist: linkml>=1.4.4
|
|
226
227
|
Requires-Dist: mwparserfromhell>=0.6.4
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
meta/__init__.py,sha256=k2uKAAzDEmm1BIVWeztFlHrCh9fq64H6szFcsXW7tvs,21
|
|
2
|
+
meta/metamodel.py,sha256=_wNFhxbiaq34VwOSyJuEz0-uDIyEDw7g29VrSkEkEW0,17297
|
|
3
|
+
meta/metamodel_cmd.py,sha256=COZUx4UanNrmDkGPyr1n7wcKGY3AgskSlgPFcC7dgnM,5746
|
|
4
|
+
meta/mw.py,sha256=tqURYYk4H3FSd2b4Tl0YJNrHp9fw4kSjbilsAZL492g,3048
|
|
5
|
+
meta/profiler.py,sha256=MedbBA85OKdzUg4Lg3VrWY_ijwCR4lKjCs9iBeb1GWE,804
|
|
6
|
+
meta/sidif2linkml.py,sha256=pnaG7xeTmLRVfqbZS7oY1yBM3lzjleZaWLybaDEGBfA,3005
|
|
7
|
+
meta/smw_type.py,sha256=9oj6xs08Zbjr69hveV6mvfe0wxQzjvYaO5D-_-eK4co,1815
|
|
8
|
+
meta/uml.py,sha256=btT4yOjZHjZx_UZh0jlJ2GDrcCcJ9-iiRZW0rreNPyk,5626
|
|
9
|
+
meta/version.py,sha256=BnvUSgSo0dMORKGRORVVCyp_sYp1ifpL29-vlJaeF4o,908
|
|
10
|
+
pymetamodel-0.2.4.dist-info/METADATA,sha256=IyTaEY2k_kvKkTYPVFoMeKRv9n8giyyZTkwetbcZTO0,15874
|
|
11
|
+
pymetamodel-0.2.4.dist-info/WHEEL,sha256=Fd6mP6ydyRguakwUJ05oBE7fh2IPxgtDN9IwHJ9OqJQ,87
|
|
12
|
+
pymetamodel-0.2.4.dist-info/entry_points.txt,sha256=2j6-XVYqqqLSXfS0dI32OJHqHzBpvUOn6-74vr_PyI4,51
|
|
13
|
+
pymetamodel-0.2.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
+
pymetamodel-0.2.4.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
meta/__init__.py,sha256=SEm2Yab8SVn8M6Td3yj4N6sd_4bL1QVFrb1JDh_QKg0,21
|
|
2
|
-
meta/metamodel.py,sha256=ytbw5ZJbbbBh59Um0c16lw9jVP23WKFOKOdTeX8Wj7M,15819
|
|
3
|
-
meta/metamodel_cmd.py,sha256=6wCLtZWw2-kItE9I9aO4pyE2l1ImafR9otISbiKTjEs,5708
|
|
4
|
-
meta/mw.py,sha256=tqURYYk4H3FSd2b4Tl0YJNrHp9fw4kSjbilsAZL492g,3048
|
|
5
|
-
meta/profiler.py,sha256=MedbBA85OKdzUg4Lg3VrWY_ijwCR4lKjCs9iBeb1GWE,804
|
|
6
|
-
meta/sidif2linkml.py,sha256=pnaG7xeTmLRVfqbZS7oY1yBM3lzjleZaWLybaDEGBfA,3005
|
|
7
|
-
meta/uml.py,sha256=btT4yOjZHjZx_UZh0jlJ2GDrcCcJ9-iiRZW0rreNPyk,5626
|
|
8
|
-
meta/version.py,sha256=BnvUSgSo0dMORKGRORVVCyp_sYp1ifpL29-vlJaeF4o,908
|
|
9
|
-
pymetamodel-0.2.2.dist-info/METADATA,sha256=gG96T-B9XIRkQ68ZL5DmQhzDaxZwVjF-EHyxTA_CrS4,15845
|
|
10
|
-
pymetamodel-0.2.2.dist-info/WHEEL,sha256=Fd6mP6ydyRguakwUJ05oBE7fh2IPxgtDN9IwHJ9OqJQ,87
|
|
11
|
-
pymetamodel-0.2.2.dist-info/entry_points.txt,sha256=2j6-XVYqqqLSXfS0dI32OJHqHzBpvUOn6-74vr_PyI4,51
|
|
12
|
-
pymetamodel-0.2.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
13
|
-
pymetamodel-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|