@@ -2915,6 +2915,12 @@ class OntologiaSimplici:
2915
2915
2916
2916
# No 1603 prefix
2917
2917
ontologia_radici : str = None
2918
+
2919
+ # dictionaria_radici: This affects how we infer "classes".
2920
+ # Without this we may make partsOf as if they're classes,
2921
+ # which may be wrong
2922
+ dictionaria_radici : str = None
2923
+
2918
2924
ordo_radici : int = None
2919
2925
data_apothecae_ex : str = []
2920
2926
caput_no1 : List [str ] = None
@@ -2929,15 +2935,23 @@ class OntologiaSimplici:
2929
2935
'@prefix p: <http://www.wikidata.org/prop/> .'
2930
2936
]
2931
2937
2938
+ PARENTES = []
2939
+
2932
2940
def __init__ (
2933
2941
self ,
2934
2942
ontologia_radici : str ,
2935
2943
ontologia_ex_archivo : str ,
2944
+ dictionaria_radici : str = None
2936
2945
):
2937
2946
2938
2947
self .ontologia_radici = numerordinatio_neo_separatum (
2939
2948
ontologia_radici , ':' )
2940
2949
self .ontologia_ex_archivo = ontologia_ex_archivo
2950
+ if dictionaria_radici :
2951
+ self .dictionaria_radici = numerordinatio_neo_separatum (
2952
+ dictionaria_radici , ':' )
2953
+ else :
2954
+ self .dictionaria_radici = self .ontologia_radici
2941
2955
2942
2956
self .initiari ()
2943
2957
@@ -2962,6 +2976,47 @@ def initiari(self):
2962
2976
))
2963
2977
2964
2978
self .ordo_radici = numerordinatio_ordo (self .ontologia_radici )
2979
+
2980
+ _parents__parts = self .dictionaria_radici .split (':' )
2981
+ _parents__parens = []
2982
+ # print('oi', _parents__parts)
2983
+ for item in _parents__parts :
2984
+ if len (_parents__parens ) == 0 :
2985
+ self .PARENTES .append (
2986
+ '<urn:{0}> rdf:type owl:Ontology .' .format (item ))
2987
+ self .PARENTES .append (
2988
+ '<urn:{0}> rdf:type owl:Class .' .format (item ))
2989
+ self .PARENTES .append ('' )
2990
+ _parents__parens .append (item )
2991
+ continue
2992
+
2993
+ # if len(_parents__parens) > 0:
2994
+ # # _parents__parens.append(item)
2995
+ # # _aa =
2996
+ # numerordinatio_nunc = ':'.join(_parents__parens)
2997
+ # else:
2998
+ # # numerordinatio_nunc = item
2999
+
3000
+ # self.PARENTES.append(
3001
+ # '<urn:{0}> rdf:type owl:Ontology .'.format(item))
3002
+ # _parents__parens.append(item)
3003
+ # continue
3004
+ _parents__parens_old = list (_parents__parens )
3005
+ _parents__parens .append (item )
3006
+ numerordinatio_nunc = ':' .join (_parents__parens )
3007
+
3008
+ self .PARENTES .append (
3009
+ '<urn:{0}> rdf:type owl:Class .' .format (numerordinatio_nunc ))
3010
+ self .PARENTES .append (
3011
+ '<urn:{0}> rdfs:subClassOf <urn:{1}> .' .format (
3012
+ numerordinatio_nunc , ':' .join (_parents__parens_old )))
3013
+ # if len(_parents__parens) > 0:
3014
+ # self.PARENTES.append(
3015
+ # '<urn:{0}> rdfs:subClassOf <urn:{1}> .'.format(
3016
+ # numerordinatio_nunc, ':'.join(_parents__parens)))
3017
+
3018
+ self .PARENTES .append ('' )
3019
+ # self.PARENTES = []
2965
3020
# pass
2966
3021
2967
3022
def imprimere_ad_tabula (self , punctum_separato : str = "," ):
@@ -2975,16 +3030,28 @@ def imprimere_ad_owl(self, punctum_separato: str = ","):
2975
3030
# - part of (P361)
2976
3031
# - https://www.wikidata.org/wiki/Property:P361
2977
3032
# - https://www.wikidata.org/wiki/Special:EntityData/P361.ttl
3033
+ # - has part or parts (P527)
3034
+ # - https://www.wikidata.org/wiki/Property:P527
3035
+ # - https://www.wikidata.org/wiki/Special:EntityData/P527.ttl
3036
+ # - inverse property (P1696)
3037
+ # - https://www.wikidata.org/wiki/Property:P1696
3038
+ # - https://www.wikidata.org/wiki/Property_talk:P1696
2978
3039
# - https://www.wikidata.org/wiki/EntitySchema:E49
3040
+ # ObjectInverseOf
3041
+ # owl:inverseOf
2979
3042
2980
3043
paginae = []
2981
3044
paginae .append ('# {0}' .format (self .ontologia_radici ))
2982
3045
paginae .extend (self .PRAEFIXUM )
2983
3046
paginae .append ('' )
2984
- paginae .append ('p:P361 a owl:ObjectProperty .' )
3047
+ paginae .append ('p:P361 rdf:type owl:ObjectProperty .' )
3048
+ paginae .append ('p:P1696 rdf:type owl:ObjectProperty .' )
3049
+ paginae .append ('p:P361 owl:inverseOf p:P1696 .' )
3050
+ paginae .append ('' )
3051
+ paginae .extend (self .PARENTES )
2985
3052
paginae .append ('' )
2986
- paginae .append (
2987
- '<urn:{0}> rdf:type owl:Ontology .' .format (self .ontologia_radici ))
3053
+ # paginae.append(
3054
+ # '<urn:{0}> rdf:type owl:Ontology .'.format(self.ontologia_radici))
2988
3055
ordo_nunc = self .ordo_radici
2989
3056
parēns = {
2990
3057
ordo_nunc : self .ontologia_radici
0 commit comments