From 93d0a3f289316516c71a6d42b11a4fd5304f2b5c Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Tue, 2 Feb 2021 20:06:15 +0100 Subject: [PATCH 01/17] Add cif-data.ttl to exemplify #16 --- cif-data.ttl | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 cif-data.ttl diff --git a/cif-data.ttl b/cif-data.ttl new file mode 100644 index 0000000..abc386d --- /dev/null +++ b/cif-data.ttl @@ -0,0 +1,159 @@ +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@base . + + rdf:type owl:Ontology ; + owl:versionIRI ; + owl:imports ; + """Part of the top-level crystallography ontology containing the CIF data ontology. + +It is implemented as a formal language.""" ; + "Creative Commons BY 4.0" . + +################################################################# +# Annotation properties +################################################################# + +### http://www.w3.org/2002/07/owl#maxQualifiedCardinality +owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . + + +################################################################# +# Classes +################################################################# + +### http://emmo.info/crystallography/cif-data#EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 +:EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 ; + "null"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d +:EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; + "Category"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 +:EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; + "_type"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 +:EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , + ; + "numb"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 +:EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d ; + "SPACE_GROUP_SYMOP"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 +:EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 + ] ; + "loop_"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 +:EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 , + :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 ; + "_space_group_symop_sg_id"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 +:EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , + :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; + "_space_group_symop_operation_xyz"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_8008aa1b_c21a_4822_aa23_aa939c5379ad +:EMMO_8008aa1b_c21a_4822_aa23_aa939c5379ad rdf:type owl:Class ; + rdfs:subClassOf :EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 , + :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , + :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 + ] ; + "_space_group_symop_[]" ; + "_space_group_symop_[]"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 +:EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; + "ROW"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 +:EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , + ; + "char"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_9cf072d2_cd36_4815_ae62_f48408809230 +:EMMO_9cf072d2_cd36_4815_ae62_f48408809230 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 + ] ; + "CIFData"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 +:EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 rdf:type owl:Class ; + rdfs:subClassOf ; + "CIF"@da . + + +### http://emmo.info/crystallography/cif-data#EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 +:EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , + :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; + "_space_group_symop_id"@da . + + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger +] . + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger + ] . + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger + ] . + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger + ] . + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger + ] . + +[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger + ] . + +### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi From 2c5af0a01711c0d99f9f6929bf91b0343ddbbe1c Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Fri, 26 Feb 2021 14:21:28 +0100 Subject: [PATCH 02/17] Update language to en --- cif-data.ttl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cif-data.ttl b/cif-data.ttl index abc386d..53c6ed8 100644 --- a/cif-data.ttl +++ b/cif-data.ttl @@ -29,32 +29,32 @@ owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . ### http://emmo.info/crystallography/cif-data#EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 :EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 rdf:type owl:Class ; rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 ; - "null"@da . + "null"@en . ### http://emmo.info/crystallography/cif-data#EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d :EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d rdf:type owl:Class ; rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "Category"@da . + "Category"@en . ### http://emmo.info/crystallography/cif-data#EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 rdf:type owl:Class ; rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "_type"@da . + "_type"@en . ### http://emmo.info/crystallography/cif-data#EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 :EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 rdf:type owl:Class ; rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , ; - "numb"@da . + "numb"@en . ### http://emmo.info/crystallography/cif-data#EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 rdf:type owl:Class ; rdfs:subClassOf :EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d ; - "SPACE_GROUP_SYMOP"@da . + "SPACE_GROUP_SYMOP"@en . ### http://emmo.info/crystallography/cif-data#EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 @@ -64,21 +64,21 @@ owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . owl:onProperty ; owl:someValuesFrom :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 ] ; - "loop_"@da . + "loop_"@en . ### http://emmo.info/crystallography/cif-data#EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 :EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 rdf:type owl:Class ; rdfs:subClassOf :EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 , :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 ; - "_space_group_symop_sg_id"@da . + "_space_group_symop_sg_id"@en . ### http://emmo.info/crystallography/cif-data#EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 :EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 rdf:type owl:Class ; rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; - "_space_group_symop_operation_xyz"@da . + "_space_group_symop_operation_xyz"@en . ### http://emmo.info/crystallography/cif-data#EMMO_8008aa1b_c21a_4822_aa23_aa939c5379ad @@ -99,20 +99,20 @@ owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . owl:someValuesFrom :EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 ] ; "_space_group_symop_[]" ; - "_space_group_symop_[]"@da . + "_space_group_symop_[]"@en . ### http://emmo.info/crystallography/cif-data#EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 rdf:type owl:Class ; rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "ROW"@da . + "ROW"@en . ### http://emmo.info/crystallography/cif-data#EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 rdf:type owl:Class ; rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , ; - "char"@da . + "char"@en . ### http://emmo.info/crystallography/cif-data#EMMO_9cf072d2_cd36_4815_ae62_f48408809230 @@ -122,20 +122,20 @@ owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . owl:onProperty ; owl:someValuesFrom :EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 ] ; - "CIFData"@da . + "CIFData"@en . ### http://emmo.info/crystallography/cif-data#EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 rdf:type owl:Class ; rdfs:subClassOf ; - "CIF"@da . + "CIF"@en . ### http://emmo.info/crystallography/cif-data#EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 :EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 rdf:type owl:Class ; rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; - "_space_group_symop_id"@da . + "_space_group_symop_id"@en . [ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger From fb3259ca23d26fd519b6328789bdfee8c37f8e9d Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Fri, 12 Mar 2021 08:47:44 +0100 Subject: [PATCH 03/17] Added a new cif.ttl file implementing v3 of the figure. --- cif.ttl | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 cif.ttl diff --git a/cif.ttl b/cif.ttl new file mode 100644 index 0000000..ad49d53 --- /dev/null +++ b/cif.ttl @@ -0,0 +1,204 @@ +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@base . + + rdf:type owl:Ontology ; + owl:versionIRI ; + owl:imports ; + "Part of the crystallography domain ontology implementing CIF 2.0 core dictionary as a formal language."@en ; + "https://creativecommons.org/licenses/by/4.0/legalcode" . + +################################################################# +# Object Properties +################################################################# + +### http://emmo.info/emmo/cif#EMMO_952122f3_7ccc_41f5_aafa_ec63a86f9795 +:EMMO_952122f3_7ccc_41f5_aafa_ec63a86f9795 rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf ; + rdfs:range :EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce ; + "hasName"@en . + + +### http://emmo.info/emmo/cif#EMMO_ba59d997_ee39_4188_b814_b5413c707e2b +:EMMO_ba59d997_ee39_4188_b814_b5413c707e2b rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf ; + "hasCifType"@en . + + +### http://emmo.info/emmo/cif#EMMO_bbdf6c2e_5bfe_4aef_adff_f64268ddb550 +:EMMO_bbdf6c2e_5bfe_4aef_adff_f64268ddb550 rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf ; + rdfs:range :EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 ; + "hasUnit"@en . + + +### http://emmo.info/emmo/cif#EMMO_d035049e_0fac_4ef7_9503_2ae420c3bfa5 +:EMMO_d035049e_0fac_4ef7_9503_2ae420c3bfa5 rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf ; + rdfs:range :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 ; + "hasType"@en . + + +################################################################# +# Data properties +################################################################# + +### http://emmo.info/emmo/cif#EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc +:EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf ; + rdfs:domain :EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb ; + "hasUncertaintyData"@en . + + +################################################################# +# Classes +################################################################# + +### http://emmo.info/emmo/cif#EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce +:EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce rdf:type owl:Class ; + rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; + "name"@en . + + +### http://emmo.info/emmo/cif#EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 +:EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; + "space_group_symop_operation_xyz"@en . + + +### http://emmo.info/emmo/cif#EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b +:EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c + ] ; + "A CIF data block."@en ; + "CIF_DATA_BLOCK"@en . + + +### http://emmo.info/emmo/cif#EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d +:EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d rdf:type owl:Class ; + rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; + "space_group_symop_id"@en . + + +### http://emmo.info/emmo/cif#EMMO_66eaa560_2015_45ac_915d_193b4438fe54 +:EMMO_66eaa560_2015_45ac_915d_193b4438fe54 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; + "type"@en . + + +### http://emmo.info/emmo/cif#EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 +:EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; + "units"@en . + + +### http://emmo.info/emmo/cif#EMMO_99d74d09_e1c2_4916_b60c_4a941ff28e99 +:EMMO_99d74d09_e1c2_4916_b60c_4a941ff28e99 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b + ] ; + "Correspondent to the content of a CIF file."@en ; + "CIF_DATA"@en . + + +### http://emmo.info/emmo/cif#EMMO_9be30786_0c19_41f1_bb94_99c77f59e1e1 +:EMMO_9be30786_0c19_41f1_bb94_99c77f59e1e1 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:string + ] ; + "char"@en . + + +### http://emmo.info/emmo/cif#EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb +:EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb rdf:type owl:Class ; + rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:double + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:double + ] ; + "numb"@en . + + +### http://emmo.info/emmo/cif#EMMO_a7dc3807_f170_401d_aed2_151996046fc2 +:EMMO_a7dc3807_f170_401d_aed2_151996046fc2 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; + "space_group_symop_sg_id"@en . + + +### http://emmo.info/emmo/cif#EMMO_aace1344_70d1_42c4_8e40_a0946c02eda2 +:EMMO_aace1344_70d1_42c4_8e40_a0946c02eda2 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :EMMO_a7dc3807_f170_401d_aed2_151996046fc2 + ] ; + "space_group_symop"@en . + + +### http://emmo.info/emmo/cif#EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 +:EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 ; + "SPACE_GROUP_SYMOP"@en . + + +### http://emmo.info/emmo/cif#EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a +:EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a rdf:type owl:Class ; + rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f ; + "DDL_CONCEPT"@en . + + +### http://emmo.info/emmo/cif#EMMO_db43fbd7_9601_4684_b54f_a36bac81f431 +:EMMO_db43fbd7_9601_4684_b54f_a36bac81f431 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 ; + "null"@en . + + +### http://emmo.info/emmo/cif#EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c +:EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c rdf:type owl:Class ; + rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; + "TABLE"@en . + + +### http://emmo.info/emmo/cif#EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 +:EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 rdf:type owl:Class ; + rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; + "CATEGORY"@en . + + +### http://emmo.info/emmo/cif#EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f +:EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f rdf:type owl:Class ; + rdfs:subClassOf ; + "Correspond to the full content of a CIF file."@en ; + "CIF"@en . + + +### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi From a63f07154099993fe8f052f3c9a2c88ddae0fdb4 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sat, 20 Mar 2021 08:57:22 +0100 Subject: [PATCH 04/17] Added annotations --- cif-data.ttl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cif-data.ttl b/cif-data.ttl index 53c6ed8..82a9ee4 100644 --- a/cif-data.ttl +++ b/cif-data.ttl @@ -7,12 +7,12 @@ @base . rdf:type owl:Ontology ; - owl:versionIRI ; - owl:imports ; - """Part of the top-level crystallography ontology containing the CIF data ontology. + owl:versionIRI ; + owl:imports ; + """Part of the top-level crystallography ontology containing the CIF data ontology. It is implemented as a formal language.""" ; - "Creative Commons BY 4.0" . + "Creative Commons BY 4.0" . ################################################################# # Annotation properties From caa3e4444af605d2bff408a4885d034384ff4dae Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 13:47:44 +0100 Subject: [PATCH 05/17] Iteration v4: * added cif-top.ttl - a hand-written ontology intended to be imported by the ontologies for the different cif dictionaries * added cif-example.ttl - a simple hand-written example of extending cif-top.ttl * added generate_cif.py - initial draft of a python script for generating cif ontologies. --- .gitignore | 3 + catalog-v001.xml | 7 +- cif-example.ttl | 125 ++++++++++++++++ cif-top.ttl | 263 +++++++++++++++++++++++++++++++++ cif.ttl | 375 ++++++++++++++++++++++++++--------------------- generate_cif.py | 126 ++++++++++++++++ 6 files changed, 730 insertions(+), 169 deletions(-) create mode 100644 cif-example.ttl create mode 100644 cif-top.ttl create mode 100755 generate_cif.py diff --git a/.gitignore b/.gitignore index 031cacf..dd6641f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *~ old + +cif_core.dic +cif_core.ttl diff --git a/catalog-v001.xml b/catalog-v001.xml index 950b502..96859d0 100644 --- a/catalog-v001.xml +++ b/catalog-v001.xml @@ -1,7 +1,10 @@ - - + + + + + diff --git a/cif-example.ttl b/cif-example.ttl new file mode 100644 index 0000000..d4c5170 --- /dev/null +++ b/cif-example.ttl @@ -0,0 +1,125 @@ +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@base . + + rdf:type owl:Ontology ; + owl:versionIRI ; + owl:imports ; + "Example of how a cif dictionary would look like when ontologised. This simple example ontologises the data items belonging to the SPACE_GROUP_SYMOP category."@en ; + "https://creativecommons.org/licenses/by/4.0/legalcode" . + +################################################################# +# Classes +################################################################# + +### http://emmo.info/domain-crystallography/cif-example#SPACE_GROUP_SYMOP +:SPACE_GROUP_SYMOP rdf:type owl:Class ; + rdfs:subClassOf ; + owl:disjointUnionOf ( :_space_group_symop_id + :_space_group_symop_operation_xyz + :_space_group_symop_sg_id + ) ; + rdfs:comment "The class of data items belonging to the SPACE_GROUP_SYMOP category."@en ; + "SPACE_GROUP_SYMOP"@en . + + +### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_ROW +:_space_group_symop_ROW rdf:type owl:Class ; + rdfs:subClassOf , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :_space_group_symop_id + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :_space_group_symop_operation_xyz + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :_space_group_symop_sg_id + ] ; + "1 x,y,z"@en ; + rdfs:comment "Stands for a row in a _space_group_symop_TABLE."@en ; + "space_group_symop_ROW"@en . + + +### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_TABLE +:_space_group_symop_TABLE rdf:type owl:Class ; + rdfs:subClassOf , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:someValuesFrom :_space_group_symop_ROW + ] , + [ rdf:type owl:Restriction ; + owl:onProperty ; + owl:allValuesFrom :SPACE_GROUP_SYMOP + ] ; + """1 x,y,z +2 -x,-y,-z +3 -x,1/2+y,1/2-z +4 x,1/2-y,1/2+z"""@en ; + rdfs:comment "Contains information about the symmetry operations of the space group."@en ; + "space_group_symop_TABLE"@en . + + +### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_id +:_space_group_symop_id rdf:type owl:Class ; + rdfs:subClassOf , + ; + "_space_group_symop_id" ; + "1"@en ; + rdfs:comment """An arbitrary identifier that uniquely labels each symmetry operation in the list. + +In order for the defaults to work correctly, the identity operation should have _space_group_symop_id or _symmetry_equiv_pos_site_id set to 1, and _space_group_symop_operation_xyz or _symmetry_equiv_pos_as_xyz set to x,y,z; i.e. the operation labelled 1 should be the identity operation."""@en ; + "space_group_symop_id"@en . + + +### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_operation_xyz +:_space_group_symop_operation_xyz rdf:type owl:Class ; + rdfs:subClassOf , + ; + "_space_group_symop_operation_xyz" ; + "x,y,z"@en ; + rdfs:comment """A parsable string giving one of the symmetry operations of the space group in algebraic form. If W is a matrix representation of the rotational part of the symmetry operation defined by the positions and signs of x, y and z, and w is a column of translations defined by fractions, an equivalent position X' is generated from a given position X by the equation + + X' = WX + w + +(Note: X is used to represent bold_italics_x in International Tables for Crystallography Vol. A, Part 5) + +When a list of symmetry operations is given, it must contain a complete set of coordinate representatives which generates all the operations of the space group by the addition of all primitive translations of the space group. Such representatives are to be found as the coordinates of the general-equivalent position in International Tables for Crystallography Vol. A (2002), to which it is necessary to add any centring translations shown above the general-equivalent position. + +That is to say, it is necessary to list explicitly all the symmetry operations required to generate all the atoms in the unit cell defined by the setting used. + +In order for the defaults to work correctly, the identity operation should have _space_group_symop_id or _symmetry_equiv_pos_site_id set to 1, and _space_group_symop_operation_xyz or _symmetry_equiv_pos_as_xyz set to x,y,z; i.e. the operation labelled 1 should be the identity operation."""@en ; + "space_group_symop_operation_xyz"@en . + + +### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_sg_id +:_space_group_symop_sg_id rdf:type owl:Class ; + rdfs:subClassOf , + ; + "_space_group_symop_sg_id" ; + rdfs:comment "This must match a particular value of _space_group_id, allowing the symmetry operation to be identified with a particular space group."@en ; + "space_group_symop_sg_id"@en . + + +################################################################# +# General axioms +################################################################# + +[ rdf:type owl:AllDisjointClasses ; + owl:members ( :_space_group_symop_id + :_space_group_symop_operation_xyz + :_space_group_symop_sg_id + ) +] . + + +### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/cif-top.ttl b/cif-top.ttl new file mode 100644 index 0000000..7022352 --- /dev/null +++ b/cif-top.ttl @@ -0,0 +1,263 @@ +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@prefix skos: . +@base . + + rdf:type owl:Ontology ; + owl:versionIRI ; + """The top-level of the CIF domain ontology. + +It tries to ahead to the CIF methods dictionary definition language (DDLm) available on https://github.com/COMCIFS/cif_core."""@en ; + "Casper Welzel Andersen, EPFL"@en , + "Emanuele Ghedini, University of Bologne"@en , + "Francesca Lønstad Bleken, SINTEF"@en , + "James Hester"@en , + "Jesper Friis, SINTEF"@en , + "Saulius Gražulis"@en , + "Stuart Chalk"@en ; + "https://creativecommons.org/licenses/by/4.0/legalcode" . + +################################################################# +# Annotation properties +################################################################# + +### http://emmo.info/domain-crystallography/cif-top#_name +:_name rdf:type owl:AnnotationProperty ; + rdfs:comment "Name associated with a data item."@en ; + rdfs:range xsd:string ; + rdfs:domain . + + +### http://emmo.info/domain-crystallography/cif-top#_unit +:_unit rdf:type owl:AnnotationProperty ; + rdfs:comment "Unit accociated to a data item."@en ; + rdfs:range xsd:string ; + rdfs:domain . + + +### http://emmo.info/domain-crystallography/cif-top#example +:example rdf:type owl:AnnotationProperty ; + rdfs:comment "Illustrative example of how the entity is used."@en ; + rdfs:subPropertyOf rdfs:comment . + + +### http://purl.org/dc/terms/abstract + rdf:type owl:AnnotationProperty . + + +### http://purl.org/dc/terms/contributor + rdf:type owl:AnnotationProperty . + + +### http://purl.org/dc/terms/creator + rdf:type owl:AnnotationProperty . + + +### http://purl.org/dc/terms/license + rdf:type owl:AnnotationProperty . + + +### http://www.w3.org/2004/02/skos/core#altLabel +skos:altLabel rdf:type owl:AnnotationProperty ; + rdfs:subPropertyOf rdfs:label . + + +### http://www.w3.org/2004/02/skos/core#prefLabel +skos:prefLabel rdf:type owl:AnnotationProperty ; + rdfs:subPropertyOf rdfs:label . + + +################################################################# +# Object Properties +################################################################# + +### http://emmo.info/domain-crystallography/cif-top#hasSpatialDirectPart +:hasSpatialDirectPart rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf :hasSpatialPart ; + rdf:type owl:InverseFunctionalProperty , + owl:AsymmetricProperty , + owl:IrreflexiveProperty ; + rdfs:comment "A non-transitive spatial part."@en , + "Direct parthood was first introduced in the European Materials & Modelling Ontology (EMMO). It allows to introduce a hierarchy of well-defined levels of granularity."@en ; + skos:prefLabel "hasSpatialDirectPart"@en . + + +### http://emmo.info/domain-crystallography/cif-top#hasSpatialPart +:hasSpatialPart rdf:type owl:ObjectProperty , + owl:TransitiveProperty ; + rdfs:comment "A part of a whole."@en , + "In a 4D mereology, 'hasSpatialPart' is a relation that isolates a proper part that extends itself in time within the overall lifetime of the whole, without covering the full spatial extension of the 4D whole (i.e. is not a temporal part)."@en ; + skos:prefLabel "hasSpatialPart"@en . + + +################################################################# +# Data properties +################################################################# + +### http://emmo.info/domain-crystallography/cif-top#hasFloatData +:hasFloatData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + rdfs:domain :_numb ; + rdfs:range xsd:double . + + +### http://emmo.info/domain-crystallography/cif-top#hasSymbolData +:hasSymbolData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + rdfs:domain :_char ; + rdfs:range xsd:string . + + +### http://emmo.info/domain-crystallography/cif-top#hasUncertaintyData +:hasUncertaintyData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf :hasFloatData ; + rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en . + + +################################################################# +# Classes +################################################################# + +### http://emmo.info/domain-crystallography/cif-top#CATEGORY +:CATEGORY rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "A classification of tables and its parts."@en ; + skos:prefLabel "CATEGORY"@en . + + +### http://emmo.info/domain-crystallography/cif-top#CIF +:CIF rdf:type owl:Class ; + rdfs:comment "the class of all data represented using the CIF dictionaries."@en ; + skos:prefLabel "CIF"@en . + + +### http://emmo.info/domain-crystallography/cif-top#CIF_DATA +:CIF_DATA rdf:type owl:Class ; + rdfs:subClassOf :CIF , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :CIF_DATA_BLOCK + ] ; + rdfs:comment "A class representing the content of a CIF file."@en ; + skos:prefLabel "CIF_DATA"@en . + + +### http://emmo.info/domain-crystallography/cif-top#CIF_DATA_BLOCK +:CIF_DATA_BLOCK rdf:type owl:Class ; + rdfs:subClassOf :CIF , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :TABLE + ] ; + rdfs:comment "A class representing a data block in a CIF file."@en ; + skos:prefLabel "CIF_DATA_BLOCK"@en . + + +### http://emmo.info/domain-crystallography/cif-top#COLUMN +:COLUMN rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :_type + ] ; + skos:prefLabel "COLUMN"@en . + + +### http://emmo.info/domain-crystallography/cif-top#DATA_ITEMS +:DATA_ITEMS rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "A row, column or function in a table."@en ; + skos:prefLabel "DATA_ITEMS"@en . + + +### http://emmo.info/domain-crystallography/cif-top#DDL_CONCEPT +:DDL_CONCEPT rdf:type owl:Class ; + rdfs:subClassOf :CIF ; + rdfs:comment "The class of concepts defined in the dictionary definition language."@en ; + skos:prefLabel "DDL_CONCEPT"@en . + + +### http://emmo.info/domain-crystallography/cif-top#FUNCTION +:FUNCTION rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS ; + skos:prefLabel "FUNCTION"@en . + + +### http://emmo.info/domain-crystallography/cif-top#ROW +:ROW rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :_type + ] ; + rdfs:comment "Represents a single row in a table with data items as direct parts."@en ; + skos:prefLabel "ROW"@en . + + +### http://emmo.info/domain-crystallography/cif-top#TABLE +:TABLE rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :ROW + ] ; + :example """Syntactically a table instance in a CIF file may be written as + +loop_ + _space_group_symop_id + _space_group_symop_operation_xyz + 1 x,y,z + 2 -x,-y,-z + 3 -x,1/2+y,1/2-z + 4 x,1/2-y,1/2+z + +but the actual TABLE individual is just the data rows: + + 1 x,y,z + 2 -x,-y,-z + 3 -x,1/2+y,1/2-z + 4 x,1/2-y,1/2+z"""@en ; + rdfs:comment "Represent a table with rows as spatial direct parts."@en , + "The syntax of individual tables starts with the 'loop_' keyword followed by the name of the data items and then the actual data."@en ; + skos:prefLabel "TABLE"@en . + + +### http://emmo.info/domain-crystallography/cif-top#_char +:_char rdf:type owl:Class ; + rdfs:subClassOf :_type ; + rdfs:comment "A symbolic data type whos individuals are strings."@en ; + skos:prefLabel "char"@en . + + +### http://emmo.info/domain-crystallography/cif-top#_null +:_null rdf:type owl:Class ; + rdfs:subClassOf :_type ; + skos:prefLabel "null"@en . + + +### http://emmo.info/domain-crystallography/cif-top#_numb +:_numb rdf:type owl:Class ; + rdfs:subClassOf :_type ; + rdfs:comment "A floating point data type with an optional associated uncertainty."@en ; + skos:prefLabel "numb"@en . + + +### http://emmo.info/domain-crystallography/cif-top#_type +:_type rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "Data items correspond to a type. Its individuals are the actual data strings or numbers."@en ; + skos:prefLabel "DATA_ITEM"@en . + + +### http://emmo.info/domain-crystallography/cif-top#enumeration +:enumeration rdf:type owl:Class ; + rdfs:subClassOf :_char ; + rdfs:comment "A subclass of `char` whos individuals is one of a limited set of pre-defined strings."@en ; + skos:prefLabel "enumeration"@en . + + +### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/cif.ttl b/cif.ttl index ad49d53..5becb72 100644 --- a/cif.ttl +++ b/cif.ttl @@ -4,201 +4,242 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . +@prefix skos: . @base . rdf:type owl:Ontology ; owl:versionIRI ; - owl:imports ; "Part of the crystallography domain ontology implementing CIF 2.0 core dictionary as a formal language."@en ; "https://creativecommons.org/licenses/by/4.0/legalcode" . ################################################################# -# Object Properties +# Annotation properties ################################################################# -### http://emmo.info/emmo/cif#EMMO_952122f3_7ccc_41f5_aafa_ec63a86f9795 -:EMMO_952122f3_7ccc_41f5_aafa_ec63a86f9795 rdf:type owl:ObjectProperty ; - rdfs:subPropertyOf ; - rdfs:range :EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce ; - "hasName"@en . +### http://emmo.info/emmo/cif#_name +:_name rdf:type owl:AnnotationProperty ; + rdfs:comment "Name associated with a data item."@en ; + rdfs:subPropertyOf skos:prefLabel ; + rdfs:range xsd:string ; + rdfs:domain . + + +### http://emmo.info/emmo/cif#_unit +:_unit rdf:type owl:AnnotationProperty ; + rdfs:comment "Unit accociated to a data item."@en ; + rdfs:range xsd:string ; + rdfs:domain . + + +### http://emmo.info/emmo/cif#example +:example rdf:type owl:AnnotationProperty ; + rdfs:comment "Illustrative example of how the entity is used."@en ; + rdfs:subPropertyOf rdfs:comment . -### http://emmo.info/emmo/cif#EMMO_ba59d997_ee39_4188_b814_b5413c707e2b -:EMMO_ba59d997_ee39_4188_b814_b5413c707e2b rdf:type owl:ObjectProperty ; - rdfs:subPropertyOf ; - "hasCifType"@en . +### http://purl.org/dc/terms/abstract + rdf:type owl:AnnotationProperty . -### http://emmo.info/emmo/cif#EMMO_bbdf6c2e_5bfe_4aef_adff_f64268ddb550 -:EMMO_bbdf6c2e_5bfe_4aef_adff_f64268ddb550 rdf:type owl:ObjectProperty ; - rdfs:subPropertyOf ; - rdfs:range :EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 ; - "hasUnit"@en . +### http://purl.org/dc/terms/license + rdf:type owl:AnnotationProperty . -### http://emmo.info/emmo/cif#EMMO_d035049e_0fac_4ef7_9503_2ae420c3bfa5 -:EMMO_d035049e_0fac_4ef7_9503_2ae420c3bfa5 rdf:type owl:ObjectProperty ; - rdfs:subPropertyOf ; - rdfs:range :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 ; - "hasType"@en . +### http://www.w3.org/2004/02/skos/core#altLabel +skos:altLabel rdf:type owl:AnnotationProperty ; + rdfs:subPropertyOf rdfs:label . + + +### http://www.w3.org/2004/02/skos/core#prefLabel +skos:prefLabel rdf:type owl:AnnotationProperty ; + rdfs:subPropertyOf rdfs:label . + + +################################################################# +# Object Properties +################################################################# + +### http://emmo.info/emmo/cif#hasSpatialDirectPart +:hasSpatialDirectPart rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf :hasSpatialPart ; + rdf:type owl:InverseFunctionalProperty , + owl:AsymmetricProperty , + owl:IrreflexiveProperty ; + rdfs:comment "A non-transitive spatial part."@en , + "Direct parthood was first introduced in the European Materials & Modelling Ontology (EMMO). It allows to introduce a hierarchy of well-defined levels of granularity."@en . + + +### http://emmo.info/emmo/cif#hasSpatialPart +:hasSpatialPart rdf:type owl:ObjectProperty , + owl:InverseFunctionalProperty , + owl:AsymmetricProperty , + owl:TransitiveProperty , + owl:IrreflexiveProperty ; + rdfs:comment "A part of a whole."@en , + "In a 4D mereology, 'hasSpatialPart' is a relation that isolates a proper part that extends itself in time within the overall lifetime of the whole, without covering the full spatial extension of the 4D whole (i.e. is not a temporal part)."@en . ################################################################# # Data properties ################################################################# -### http://emmo.info/emmo/cif#EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc -:EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc rdf:type owl:DatatypeProperty ; - rdfs:subPropertyOf ; - rdfs:domain :EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb ; - "hasUncertaintyData"@en . +### http://emmo.info/emmo/cif#hasFloatData +:hasFloatData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + rdfs:domain :_numb ; + rdfs:range xsd:double . + + +### http://emmo.info/emmo/cif#hasSymbolData +:hasSymbolData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + rdfs:domain :_char ; + rdfs:range xsd:string . + + +### http://emmo.info/emmo/cif#hasUncertaintyData +:hasUncertaintyData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf :hasFloatData ; + rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en . ################################################################# # Classes ################################################################# -### http://emmo.info/emmo/cif#EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce -:EMMO_122e6f39_4df7_4124_9137_9d5fab11b2ce rdf:type owl:Class ; - rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; - "name"@en . - - -### http://emmo.info/emmo/cif#EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 -:EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; - "space_group_symop_operation_xyz"@en . - - -### http://emmo.info/emmo/cif#EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b -:EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c - ] ; - "A CIF data block."@en ; - "CIF_DATA_BLOCK"@en . - - -### http://emmo.info/emmo/cif#EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d -:EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d rdf:type owl:Class ; - rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; - "space_group_symop_id"@en . - - -### http://emmo.info/emmo/cif#EMMO_66eaa560_2015_45ac_915d_193b4438fe54 -:EMMO_66eaa560_2015_45ac_915d_193b4438fe54 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; - "type"@en . - - -### http://emmo.info/emmo/cif#EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 -:EMMO_6eac2765_da47_41ca_94f5_1d739b2b5cb5 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; - "units"@en . - - -### http://emmo.info/emmo/cif#EMMO_99d74d09_e1c2_4916_b60c_4a941ff28e99 -:EMMO_99d74d09_e1c2_4916_b60c_4a941ff28e99 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_39858df9_91b8_4942_b8bf_e17b77e9290b - ] ; - "Correspondent to the content of a CIF file."@en ; - "CIF_DATA"@en . - - -### http://emmo.info/emmo/cif#EMMO_9be30786_0c19_41f1_bb94_99c77f59e1e1 -:EMMO_9be30786_0c19_41f1_bb94_99c77f59e1e1 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onDataRange xsd:string - ] ; - "char"@en . - - -### http://emmo.info/emmo/cif#EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb -:EMMO_a6942e34_68aa_4bc8_b1d3_ba4f75f566cb rdf:type owl:Class ; - rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onDataRange xsd:double - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :EMMO_ac942115_8863_4a22_b3b2_f8d22cb600bc ; - owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onDataRange xsd:double - ] ; - "numb"@en . - - -### http://emmo.info/emmo/cif#EMMO_a7dc3807_f170_401d_aed2_151996046fc2 -:EMMO_a7dc3807_f170_401d_aed2_151996046fc2 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 ; - "space_group_symop_sg_id"@en . - - -### http://emmo.info/emmo/cif#EMMO_aace1344_70d1_42c4_8e40_a0946c02eda2 -:EMMO_aace1344_70d1_42c4_8e40_a0946c02eda2 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onClass :EMMO_1b38a902_ff8f_41d9_a9e4_1bb28f2e82a5 - ] , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onClass :EMMO_57b323f8_f2fc_412c_b600_e1629a41d16d - ] , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; - owl:onClass :EMMO_a7dc3807_f170_401d_aed2_151996046fc2 - ] ; - "space_group_symop"@en . - - -### http://emmo.info/emmo/cif#EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 -:EMMO_c889c5b5_138f_41b3_b232_3812fa2ca1e9 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 ; - "SPACE_GROUP_SYMOP"@en . - - -### http://emmo.info/emmo/cif#EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a -:EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f ; - "DDL_CONCEPT"@en . - - -### http://emmo.info/emmo/cif#EMMO_db43fbd7_9601_4684_b54f_a36bac81f431 -:EMMO_db43fbd7_9601_4684_b54f_a36bac81f431 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_66eaa560_2015_45ac_915d_193b4438fe54 ; - "null"@en . - - -### http://emmo.info/emmo/cif#EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c -:EMMO_e2655fcc_436e_4bcd_9a30_45c9fbb27d1c rdf:type owl:Class ; - rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; - "TABLE"@en . - - -### http://emmo.info/emmo/cif#EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 -:EMMO_e61989aa_d0d1_41a8_98cd_31e565eaa318 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_d6dd4e75_2b06_46d5_9c46_594ffdacaf2a ; - "CATEGORY"@en . - - -### http://emmo.info/emmo/cif#EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f -:EMMO_e835e5b7_60d3_4e5e_9505_c6558444b89f rdf:type owl:Class ; - rdfs:subClassOf ; - "Correspond to the full content of a CIF file."@en ; - "CIF"@en . +### http://emmo.info/emmo/cif#CATEGORY +:CATEGORY rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "A classification of tables and its parts."@en ; + skos:prefLabel "CATEGORY"@en . + + +### http://emmo.info/emmo/cif#CIF +:CIF rdf:type owl:Class ; + rdfs:comment "the class of all data represented using the CIF dictionaries."@en ; + skos:prefLabel "CIF"@en . + + +### http://emmo.info/emmo/cif#CIF_DATA +:CIF_DATA rdf:type owl:Class ; + rdfs:subClassOf :CIF , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :CIF_DATA_BLOCK + ] ; + rdfs:comment "A class representing the content of a CIF file."@en ; + skos:prefLabel "CIF_DATA"@en . + + +### http://emmo.info/emmo/cif#CIF_DATA_BLOCK +:CIF_DATA_BLOCK rdf:type owl:Class ; + rdfs:subClassOf :CIF , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :TABLE + ] ; + rdfs:comment "A class representing a data block in a CIF file."@en ; + skos:prefLabel "CIF_DATA_BLOCK"@en . + + +### http://emmo.info/emmo/cif#COLUMN +:COLUMN rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :_type + ] . + + +### http://emmo.info/emmo/cif#DATA_ITEMS +:DATA_ITEMS rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "A row, column or function in a table."@en ; + skos:prefLabel "DATA_ITEMS"@en . + + +### http://emmo.info/emmo/cif#DDL_CONCEPT +:DDL_CONCEPT rdf:type owl:Class ; + rdfs:subClassOf :CIF ; + rdfs:comment "The class of concepts defined in the dictionary definition language."@en ; + skos:prefLabel "DDL_CONCEPT"@en . + + +### http://emmo.info/emmo/cif#FUNCTION +:FUNCTION rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS . + + +### http://emmo.info/emmo/cif#ROW +:ROW rdf:type owl:Class ; + rdfs:subClassOf :DATA_ITEMS , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :_type + ] ; + rdfs:comment "Represents a single row in a table with data items as direct parts."@en . + + +### http://emmo.info/emmo/cif#TABLE +:TABLE rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :ROW + ] ; + :example """Syntactically a table instance in a CIF file may be written as + +loop_ + _space_group_symop_id + _space_group_symop_operation_xyz + 1 x,y,z + 2 -x,-y,-z + 3 -x,1/2+y,1/2-z + 4 x,1/2-y,1/2+z + +but the actual TABLE instance is just the data rows: + + 1 x,y,z + 2 -x,-y,-z + 3 -x,1/2+y,1/2-z + 4 x,1/2-y,1/2+z"""@en ; + rdfs:comment "Represent a table with rows as spatial direct parts."@en , + "The syntax of individual tables starts with the 'loop_' keyword followed by the name of the data items and then the actual data."@en ; + skos:prefLabel "TABLE"@en . + + +### http://emmo.info/emmo/cif#_char +:_char rdf:type owl:Class ; + rdfs:subClassOf :_type ; + skos:prefLabel "A symbolic data type whos individuals are strings."@en , + "char"@en . + + +### http://emmo.info/emmo/cif#_null +:_null rdf:type owl:Class ; + rdfs:subClassOf :_type ; + skos:prefLabel "null"@en . + + +### http://emmo.info/emmo/cif#_numb +:_numb rdf:type owl:Class ; + rdfs:subClassOf :_type ; + rdfs:comment "A floating point data type with an optional associated uncertainty."@en ; + skos:prefLabel "numb"@en . + + +### http://emmo.info/emmo/cif#_type +:_type rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "Data items correspond to a type. Its individuals are the actual data strings or numbers."@en ; + skos:prefLabel "DATA_ITEM"@en . + + +### http://emmo.info/emmo/cif#enumeration +:enumeration rdf:type owl:Class ; + rdfs:subClassOf :_char ; + rdfs:comment "A subclass of `char` whos individuals is one of a limited set of pre-defined strings."@en ; + skos:prefLabel "enumeration"@en . ### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/generate_cif.py b/generate_cif.py new file mode 100755 index 0000000..513e83d --- /dev/null +++ b/generate_cif.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +"""Python script for generating an ontology corresponding to a CIF dictionary. +""" +import os +import types +import textwrap +import urllib.request + +from emmo import World +from CifFile import ReadCif + + +class Generator: + """Class for generating CIF ontology from a CIF dictionary.""" + def __init__(self, dicfile, output, cif_top='cif-top.ttl', + iri='http://emmo.info/crystallography/cif-core#', + version=None, version_iri=None): + self.cf = ReadCif(dicfile) + self.output = output + self.cif_top = cif_top + self.version = version + self.version_iri = version_iri + + self.categories = set() + + # Load cif-top ontology + self.world = World() + self.top = self.world.get_ontology(cif_top).load() + self.top.sync_python_names() + + # Create new ontology + self.onto = self.world.get_ontology(iri) + self.onto.imported_ontologies.append(self.top) + + def generate(self, dicts=None): + """Generate ontology.""" + if dicts is None: + dicts = self.cf.keys() + for dicname in dicts: + self._generate_dic(dicname) + return self.onto + #self._write() + + def _generate_dic(self, dicname): + """Generate ontology for dictionary `name`.""" + # Add categories + for item in self.cf.get_children(dicname): + if '_definition.scope' in item: + self._add_category(item) + + # Add data items + for item in self.cf.get_children(dicname): + if '_definition.scope' not in item: + self._add_data_item(item) + + def _add_category(self, item): + """Add category.""" + if item in self.categories: + return + self.categories.add(item) + + name = item['_definition.id'] + descr = item.get('_description.text') + lname = '_' + name.lstrip('_').lower() + with self.onto: + if item.get('_definition.class') in ('Loop', 'Set'): + table = types.new_class(lname + '_TABLE', (self.top.TABLE, )) + table.prefLabel.append(table.name.lstrip('_')) + row = types.new_class(lname + '_ROW', (self.top.ROW, )) + row.prefLabel.append(row.name.lstrip('_')) + cat = types.new_class(name, (self.top.CATEGORY, )) + cat.prefLabel.append(cat.name.lstrip('_')) + if descr: + cat.comment.append(textwrap.dedent(descr)) + table.is_a.append(self.top.hasSpatialDirectPart.some(row)) + table.is_a.append(self.top.hasSpatialPart.only(cat)) + else: + print('** ignoring category:', name) + + + def _add_data_item(self, item): + """Add data item.""" + name = item['_definition.id'] + descr = item.get('_description.text') + category_name = item['_name.category_id'].upper() + row_name = '_%s_ROW' % item['_name.category_id'] + if category_name in self.onto: + category = self.onto[category_name] + with self.onto: + e = types.new_class(name, (category, )) + e.prefLabel.append(name.lstrip('_')) + if descr: + e.comment.append(textwrap.dedent(descr)) + if row_name in self.onto: + row = self.onto[row_name] + row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) + + else: + print('** no row:', name) + else: + print('** no category:', name) + + +def main(): + # Download the CIF core dictionary to current directory + if not os.path.exists('cif_core.dic'): + urllib.request.urlretrieve( + 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' + 'cif_core.dic', 'cif_core.dic') + + gen = Generator(dicfile='cif_core.dic', output='cif_core.ttl') + onto = gen.generate() + + # Annotate ontology + onto.sync_attributes() + onto.set_version(version='0.0.1') + onto.metadata.abstract = ( + 'CIF core ontology generated from the CIF core definitions at ' + 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' + ) + + onto.save('cif_core.ttl', overwrite=True) + + +if __name__ == '__main__': + main() From f7a82bba60a97f73635ea705459a6700c2ff0a4a Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 14:02:37 +0100 Subject: [PATCH 06/17] Added missing prefLabel and updated test --- .github/workflows/ci_emmocheck.yml | 3 ++- cif-top.ttl | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_emmocheck.yml b/.github/workflows/ci_emmocheck.yml index 8e0b486..ed0d22a 100644 --- a/.github/workflows/ci_emmocheck.yml +++ b/.github/workflows/ci_emmocheck.yml @@ -26,4 +26,5 @@ jobs: - name: Check EMMO run: | - emmocheck --verbose crystallography.ttl + emmocheck --verbose --skip test_class_label cif-top.ttl + #emmocheck --verbose crystallography.ttl diff --git a/cif-top.ttl b/cif-top.ttl index 7022352..126e4bd 100644 --- a/cif-top.ttl +++ b/cif-top.ttl @@ -28,6 +28,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail ### http://emmo.info/domain-crystallography/cif-top#_name :_name rdf:type owl:AnnotationProperty ; rdfs:comment "Name associated with a data item."@en ; + skos:prefLabel "_name"@en ; rdfs:range xsd:string ; rdfs:domain . @@ -35,6 +36,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail ### http://emmo.info/domain-crystallography/cif-top#_unit :_unit rdf:type owl:AnnotationProperty ; rdfs:comment "Unit accociated to a data item."@en ; + skos:prefLabel "_unit"@en ; rdfs:range xsd:string ; rdfs:domain . @@ -42,6 +44,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail ### http://emmo.info/domain-crystallography/cif-top#example :example rdf:type owl:AnnotationProperty ; rdfs:comment "Illustrative example of how the entity is used."@en ; + skos:prefLabel "example"@en ; rdfs:subPropertyOf rdfs:comment . @@ -102,20 +105,23 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; :hasFloatData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf owl:topDataProperty ; rdfs:domain :_numb ; - rdfs:range xsd:double . + rdfs:range xsd:double ; + skos:prefLabel "hasFloatData"@en . ### http://emmo.info/domain-crystallography/cif-top#hasSymbolData :hasSymbolData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf owl:topDataProperty ; rdfs:domain :_char ; - rdfs:range xsd:string . + rdfs:range xsd:string ; + skos:prefLabel "hasSymbolData"@en . ### http://emmo.info/domain-crystallography/cif-top#hasUncertaintyData :hasUncertaintyData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf :hasFloatData ; - rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en . + rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en ; + skos:prefLabel "hasUncertaintyData"@en . ################################################################# From 2ecd27e77353ecea26964ba9492bf622f07a2376 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 14:11:14 +0100 Subject: [PATCH 07/17] Renamed cif-top, cif-example and cif-core to cif_top, cif_example and cif_core for better consistency with the CIF naming scheme. --- .github/workflows/ci_emmocheck.yml | 2 +- catalog-v001.xml | 6 +- cif-data.ttl | 159 ----------------------------- cif-example.ttl => cif_example.ttl | 64 ++++++------ cif-top.ttl => cif_top.ttl | 54 +++++----- generate_cif.py | 6 +- 6 files changed, 66 insertions(+), 225 deletions(-) delete mode 100644 cif-data.ttl rename cif-example.ttl => cif_example.ttl (82%) rename cif-top.ttl => cif_top.ttl (85%) diff --git a/.github/workflows/ci_emmocheck.yml b/.github/workflows/ci_emmocheck.yml index ed0d22a..04673e6 100644 --- a/.github/workflows/ci_emmocheck.yml +++ b/.github/workflows/ci_emmocheck.yml @@ -26,5 +26,5 @@ jobs: - name: Check EMMO run: | - emmocheck --verbose --skip test_class_label cif-top.ttl + emmocheck --verbose --skip test_class_label cif_top.ttl #emmocheck --verbose crystallography.ttl diff --git a/catalog-v001.xml b/catalog-v001.xml index 96859d0..1de9e7f 100644 --- a/catalog-v001.xml +++ b/catalog-v001.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/cif-data.ttl b/cif-data.ttl deleted file mode 100644 index 82a9ee4..0000000 --- a/cif-data.ttl +++ /dev/null @@ -1,159 +0,0 @@ -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@base . - - rdf:type owl:Ontology ; - owl:versionIRI ; - owl:imports ; - """Part of the top-level crystallography ontology containing the CIF data ontology. - -It is implemented as a formal language.""" ; - "Creative Commons BY 4.0" . - -################################################################# -# Annotation properties -################################################################# - -### http://www.w3.org/2002/07/owl#maxQualifiedCardinality -owl:maxQualifiedCardinality rdf:type owl:AnnotationProperty . - - -################################################################# -# Classes -################################################################# - -### http://emmo.info/crystallography/cif-data#EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 -:EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 ; - "null"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d -:EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "Category"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 -:EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "_type"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 -:EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , - ; - "numb"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 -:EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_338c4590_9400_4dc0_a0e1_1f0ca30b312d ; - "SPACE_GROUP_SYMOP"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 -:EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 - ] ; - "loop_"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 -:EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_507d4604_be6e_4257_bea1_d463c5d95f04 , - :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 ; - "_space_group_symop_sg_id"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 -:EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , - :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; - "_space_group_symop_operation_xyz"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_8008aa1b_c21a_4822_aa23_aa939c5379ad -:EMMO_8008aa1b_c21a_4822_aa23_aa939c5379ad rdf:type owl:Class ; - rdfs:subClassOf :EMMO_171dc3c0_b34f_49eb_a47d_9672cd208739 , - :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , - :EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_69e2bc25_4d82_4944_96b4_8d367deb2f88 - ] , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_6b78aa79_73dc_4962_a718_0b2a769f4fe0 - ] , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 - ] ; - "_space_group_symop_[]" ; - "_space_group_symop_[]"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 -:EMMO_8a7292de_4dab_46e2_9164_fb94f27e7090 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 ; - "ROW"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 -:EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_33f1a30c_e4ab_4b48_85f7_e19cc94bd048 , - ; - "char"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_9cf072d2_cd36_4815_ae62_f48408809230 -:EMMO_9cf072d2_cd36_4815_ae62_f48408809230 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 , - [ rdf:type owl:Restriction ; - owl:onProperty ; - owl:someValuesFrom :EMMO_685319a1_41a6_48fb_b95e_e0a2fff5f950 - ] ; - "CIFData"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 -:EMMO_e2b9c4b5_2bd5_4908_938c_93439408e301 rdf:type owl:Class ; - rdfs:subClassOf ; - "CIF"@en . - - -### http://emmo.info/crystallography/cif-data#EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 -:EMMO_f4688aae_db82_4f7c_97e2_d38aaaccb783 rdf:type owl:Class ; - rdfs:subClassOf :EMMO_64315d26_6acf_4fd4_a18f_863ae62b4be8 , - :EMMO_9c1ff44b_2a27_4d8c_b80a_213b6c120fb3 ; - "_space_group_symop_id"@en . - - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger -] . - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - -[ owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - -### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/cif-example.ttl b/cif_example.ttl similarity index 82% rename from cif-example.ttl rename to cif_example.ttl index d4c5170..5f5ee86 100644 --- a/cif-example.ttl +++ b/cif_example.ttl @@ -1,14 +1,14 @@ -@prefix : . +@prefix : . @prefix owl: . @prefix rdf: . @prefix xml: . @prefix xsd: . @prefix rdfs: . -@base . +@base . - rdf:type owl:Ontology ; - owl:versionIRI ; - owl:imports ; + rdf:type owl:Ontology ; + owl:versionIRI ; + owl:imports ; "Example of how a cif dictionary would look like when ontologised. This simple example ontologises the data items belonging to the SPACE_GROUP_SYMOP category."@en ; "https://creativecommons.org/licenses/by/4.0/legalcode" . @@ -16,9 +16,9 @@ # Classes ################################################################# -### http://emmo.info/domain-crystallography/cif-example#SPACE_GROUP_SYMOP +### http://emmo.info/domain-crystallography/cif_example#SPACE_GROUP_SYMOP :SPACE_GROUP_SYMOP rdf:type owl:Class ; - rdfs:subClassOf ; + rdfs:subClassOf ; owl:disjointUnionOf ( :_space_group_symop_id :_space_group_symop_operation_xyz :_space_group_symop_sg_id @@ -27,41 +27,41 @@ "SPACE_GROUP_SYMOP"@en . -### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_ROW +### http://emmo.info/domain-crystallography/cif_example#_space_group_symop_ROW :_space_group_symop_ROW rdf:type owl:Class ; - rdfs:subClassOf , + rdfs:subClassOf , [ rdf:type owl:Restriction ; - owl:onProperty ; + owl:onProperty ; owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; owl:onClass :_space_group_symop_id ] , [ rdf:type owl:Restriction ; - owl:onProperty ; + owl:onProperty ; owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; owl:onClass :_space_group_symop_operation_xyz ] , [ rdf:type owl:Restriction ; - owl:onProperty ; + owl:onProperty ; owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ; owl:onClass :_space_group_symop_sg_id ] ; - "1 x,y,z"@en ; + "1 x,y,z"@en ; rdfs:comment "Stands for a row in a _space_group_symop_TABLE."@en ; "space_group_symop_ROW"@en . -### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_TABLE +### http://emmo.info/domain-crystallography/cif_example#_space_group_symop_TABLE :_space_group_symop_TABLE rdf:type owl:Class ; - rdfs:subClassOf , + rdfs:subClassOf , [ rdf:type owl:Restriction ; - owl:onProperty ; + owl:onProperty ; owl:someValuesFrom :_space_group_symop_ROW ] , [ rdf:type owl:Restriction ; - owl:onProperty ; + owl:onProperty ; owl:allValuesFrom :SPACE_GROUP_SYMOP ] ; - """1 x,y,z + """1 x,y,z 2 -x,-y,-z 3 -x,1/2+y,1/2-z 4 x,1/2-y,1/2+z"""@en ; @@ -69,24 +69,24 @@ "space_group_symop_TABLE"@en . -### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_id +### http://emmo.info/domain-crystallography/cif_example#_space_group_symop_id :_space_group_symop_id rdf:type owl:Class ; - rdfs:subClassOf , - ; - "_space_group_symop_id" ; - "1"@en ; + rdfs:subClassOf , + ; + "_space_group_symop_id" ; + "1"@en ; rdfs:comment """An arbitrary identifier that uniquely labels each symmetry operation in the list. In order for the defaults to work correctly, the identity operation should have _space_group_symop_id or _symmetry_equiv_pos_site_id set to 1, and _space_group_symop_operation_xyz or _symmetry_equiv_pos_as_xyz set to x,y,z; i.e. the operation labelled 1 should be the identity operation."""@en ; "space_group_symop_id"@en . -### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_operation_xyz +### http://emmo.info/domain-crystallography/cif_example#_space_group_symop_operation_xyz :_space_group_symop_operation_xyz rdf:type owl:Class ; - rdfs:subClassOf , - ; - "_space_group_symop_operation_xyz" ; - "x,y,z"@en ; + rdfs:subClassOf , + ; + "_space_group_symop_operation_xyz" ; + "x,y,z"@en ; rdfs:comment """A parsable string giving one of the symmetry operations of the space group in algebraic form. If W is a matrix representation of the rotational part of the symmetry operation defined by the positions and signs of x, y and z, and w is a column of translations defined by fractions, an equivalent position X' is generated from a given position X by the equation X' = WX + w @@ -101,11 +101,11 @@ In order for the defaults to work correctly, the identity operation should have "space_group_symop_operation_xyz"@en . -### http://emmo.info/domain-crystallography/cif-example#_space_group_symop_sg_id +### http://emmo.info/domain-crystallography/cif_example#_space_group_symop_sg_id :_space_group_symop_sg_id rdf:type owl:Class ; - rdfs:subClassOf , - ; - "_space_group_symop_sg_id" ; + rdfs:subClassOf , + ; + "_space_group_symop_sg_id" ; rdfs:comment "This must match a particular value of _space_group_id, allowing the symmetry operation to be identified with a particular space group."@en ; "space_group_symop_sg_id"@en . diff --git a/cif-top.ttl b/cif_top.ttl similarity index 85% rename from cif-top.ttl rename to cif_top.ttl index 126e4bd..f86ef0d 100644 --- a/cif-top.ttl +++ b/cif_top.ttl @@ -1,14 +1,14 @@ -@prefix : . +@prefix : . @prefix owl: . @prefix rdf: . @prefix xml: . @prefix xsd: . @prefix rdfs: . @prefix skos: . -@base . +@base . - rdf:type owl:Ontology ; - owl:versionIRI ; + rdf:type owl:Ontology ; + owl:versionIRI ; """The top-level of the CIF domain ontology. It tries to ahead to the CIF methods dictionary definition language (DDLm) available on https://github.com/COMCIFS/cif_core."""@en ; @@ -25,7 +25,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail # Annotation properties ################################################################# -### http://emmo.info/domain-crystallography/cif-top#_name +### http://emmo.info/domain-crystallography/cif_top#_name :_name rdf:type owl:AnnotationProperty ; rdfs:comment "Name associated with a data item."@en ; skos:prefLabel "_name"@en ; @@ -33,7 +33,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail rdfs:domain . -### http://emmo.info/domain-crystallography/cif-top#_unit +### http://emmo.info/domain-crystallography/cif_top#_unit :_unit rdf:type owl:AnnotationProperty ; rdfs:comment "Unit accociated to a data item."@en ; skos:prefLabel "_unit"@en ; @@ -41,7 +41,7 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail rdfs:domain . -### http://emmo.info/domain-crystallography/cif-top#example +### http://emmo.info/domain-crystallography/cif_top#example :example rdf:type owl:AnnotationProperty ; rdfs:comment "Illustrative example of how the entity is used."@en ; skos:prefLabel "example"@en ; @@ -78,7 +78,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; # Object Properties ################################################################# -### http://emmo.info/domain-crystallography/cif-top#hasSpatialDirectPart +### http://emmo.info/domain-crystallography/cif_top#hasSpatialDirectPart :hasSpatialDirectPart rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :hasSpatialPart ; rdf:type owl:InverseFunctionalProperty , @@ -89,7 +89,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "hasSpatialDirectPart"@en . -### http://emmo.info/domain-crystallography/cif-top#hasSpatialPart +### http://emmo.info/domain-crystallography/cif_top#hasSpatialPart :hasSpatialPart rdf:type owl:ObjectProperty , owl:TransitiveProperty ; rdfs:comment "A part of a whole."@en , @@ -101,7 +101,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; # Data properties ################################################################# -### http://emmo.info/domain-crystallography/cif-top#hasFloatData +### http://emmo.info/domain-crystallography/cif_top#hasFloatData :hasFloatData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf owl:topDataProperty ; rdfs:domain :_numb ; @@ -109,7 +109,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "hasFloatData"@en . -### http://emmo.info/domain-crystallography/cif-top#hasSymbolData +### http://emmo.info/domain-crystallography/cif_top#hasSymbolData :hasSymbolData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf owl:topDataProperty ; rdfs:domain :_char ; @@ -117,7 +117,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "hasSymbolData"@en . -### http://emmo.info/domain-crystallography/cif-top#hasUncertaintyData +### http://emmo.info/domain-crystallography/cif_top#hasUncertaintyData :hasUncertaintyData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf :hasFloatData ; rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en ; @@ -128,20 +128,20 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; # Classes ################################################################# -### http://emmo.info/domain-crystallography/cif-top#CATEGORY +### http://emmo.info/domain-crystallography/cif_top#CATEGORY :CATEGORY rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT ; rdfs:comment "A classification of tables and its parts."@en ; skos:prefLabel "CATEGORY"@en . -### http://emmo.info/domain-crystallography/cif-top#CIF +### http://emmo.info/domain-crystallography/cif_top#CIF :CIF rdf:type owl:Class ; rdfs:comment "the class of all data represented using the CIF dictionaries."@en ; skos:prefLabel "CIF"@en . -### http://emmo.info/domain-crystallography/cif-top#CIF_DATA +### http://emmo.info/domain-crystallography/cif_top#CIF_DATA :CIF_DATA rdf:type owl:Class ; rdfs:subClassOf :CIF , [ rdf:type owl:Restriction ; @@ -152,7 +152,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "CIF_DATA"@en . -### http://emmo.info/domain-crystallography/cif-top#CIF_DATA_BLOCK +### http://emmo.info/domain-crystallography/cif_top#CIF_DATA_BLOCK :CIF_DATA_BLOCK rdf:type owl:Class ; rdfs:subClassOf :CIF , [ rdf:type owl:Restriction ; @@ -163,7 +163,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "CIF_DATA_BLOCK"@en . -### http://emmo.info/domain-crystallography/cif-top#COLUMN +### http://emmo.info/domain-crystallography/cif_top#COLUMN :COLUMN rdf:type owl:Class ; rdfs:subClassOf :DATA_ITEMS , [ rdf:type owl:Restriction ; @@ -173,27 +173,27 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "COLUMN"@en . -### http://emmo.info/domain-crystallography/cif-top#DATA_ITEMS +### http://emmo.info/domain-crystallography/cif_top#DATA_ITEMS :DATA_ITEMS rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT ; rdfs:comment "A row, column or function in a table."@en ; skos:prefLabel "DATA_ITEMS"@en . -### http://emmo.info/domain-crystallography/cif-top#DDL_CONCEPT +### http://emmo.info/domain-crystallography/cif_top#DDL_CONCEPT :DDL_CONCEPT rdf:type owl:Class ; rdfs:subClassOf :CIF ; rdfs:comment "The class of concepts defined in the dictionary definition language."@en ; skos:prefLabel "DDL_CONCEPT"@en . -### http://emmo.info/domain-crystallography/cif-top#FUNCTION +### http://emmo.info/domain-crystallography/cif_top#FUNCTION :FUNCTION rdf:type owl:Class ; rdfs:subClassOf :DATA_ITEMS ; skos:prefLabel "FUNCTION"@en . -### http://emmo.info/domain-crystallography/cif-top#ROW +### http://emmo.info/domain-crystallography/cif_top#ROW :ROW rdf:type owl:Class ; rdfs:subClassOf :DATA_ITEMS , [ rdf:type owl:Restriction ; @@ -204,7 +204,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "ROW"@en . -### http://emmo.info/domain-crystallography/cif-top#TABLE +### http://emmo.info/domain-crystallography/cif_top#TABLE :TABLE rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT , [ rdf:type owl:Restriction ; @@ -232,34 +232,34 @@ but the actual TABLE individual is just the data rows: skos:prefLabel "TABLE"@en . -### http://emmo.info/domain-crystallography/cif-top#_char +### http://emmo.info/domain-crystallography/cif_top#_char :_char rdf:type owl:Class ; rdfs:subClassOf :_type ; rdfs:comment "A symbolic data type whos individuals are strings."@en ; skos:prefLabel "char"@en . -### http://emmo.info/domain-crystallography/cif-top#_null +### http://emmo.info/domain-crystallography/cif_top#_null :_null rdf:type owl:Class ; rdfs:subClassOf :_type ; skos:prefLabel "null"@en . -### http://emmo.info/domain-crystallography/cif-top#_numb +### http://emmo.info/domain-crystallography/cif_top#_numb :_numb rdf:type owl:Class ; rdfs:subClassOf :_type ; rdfs:comment "A floating point data type with an optional associated uncertainty."@en ; skos:prefLabel "numb"@en . -### http://emmo.info/domain-crystallography/cif-top#_type +### http://emmo.info/domain-crystallography/cif_top#_type :_type rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT ; rdfs:comment "Data items correspond to a type. Its individuals are the actual data strings or numbers."@en ; skos:prefLabel "DATA_ITEM"@en . -### http://emmo.info/domain-crystallography/cif-top#enumeration +### http://emmo.info/domain-crystallography/cif_top#enumeration :enumeration rdf:type owl:Class ; rdfs:subClassOf :_char ; rdfs:comment "A subclass of `char` whos individuals is one of a limited set of pre-defined strings."@en ; diff --git a/generate_cif.py b/generate_cif.py index 513e83d..88d1c9e 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -12,8 +12,8 @@ class Generator: """Class for generating CIF ontology from a CIF dictionary.""" - def __init__(self, dicfile, output, cif_top='cif-top.ttl', - iri='http://emmo.info/crystallography/cif-core#', + def __init__(self, dicfile, output, cif_top='cif_top.ttl', + iri='http://emmo.info/crystallography/cif_core#', version=None, version_iri=None): self.cf = ReadCif(dicfile) self.output = output @@ -23,7 +23,7 @@ def __init__(self, dicfile, output, cif_top='cif-top.ttl', self.categories = set() - # Load cif-top ontology + # Load cif_top ontology self.world = World() self.top = self.world.get_ontology(cif_top).load() self.top.sync_python_names() From 677b206b2637aa027d31b6eb690dff485deb66c1 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 15:37:26 +0100 Subject: [PATCH 08/17] Made generated categories disjoint unions of their related data items. --- generate_cif.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generate_cif.py b/generate_cif.py index 88d1c9e..2c47d0a 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -39,7 +39,6 @@ def generate(self, dicts=None): for dicname in dicts: self._generate_dic(dicname) return self.onto - #self._write() def _generate_dic(self, dicname): """Generate ontology for dictionary `name`.""" @@ -77,7 +76,6 @@ def _add_category(self, item): else: print('** ignoring category:', name) - def _add_data_item(self, item): """Add data item.""" name = item['_definition.id'] @@ -87,7 +85,12 @@ def _add_data_item(self, item): if category_name in self.onto: category = self.onto[category_name] with self.onto: + # FIXME - inherit from type instead of category e = types.new_class(name, (category, )) + if category.disjoint_unions: + category.disjoint_unions[0].append(e) + else: + category.disjoint_unions.append([e]) e.prefLabel.append(name.lstrip('_')) if descr: e.comment.append(textwrap.dedent(descr)) From fdc4de9dba8a225c9ffcf7a6ce01abad835a70d3 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 16:02:22 +0100 Subject: [PATCH 09/17] Cleaned up generate_cif.py --- generate_cif.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/generate_cif.py b/generate_cif.py index 2c47d0a..caa727b 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -11,16 +11,19 @@ class Generator: - """Class for generating CIF ontology from a CIF dictionary.""" - def __init__(self, dicfile, output, cif_top='cif_top.ttl', - iri='http://emmo.info/crystallography/cif_core#', - version=None, version_iri=None): + """Class for generating CIF ontology from a CIF dictionary. + + Parameters: + dicfile : string + File name of CIF dictionary to generate an ontology for. + base_iri : string + Base IRI of the generated ontology. + cif_top : string + URI or file name of the cif_top ontology that will be imported. + """ + def __init__(self, dicfile, base_iri, cif_top='cif_top.ttl'): self.cf = ReadCif(dicfile) - self.output = output self.cif_top = cif_top - self.version = version - self.version_iri = version_iri - self.categories = set() # Load cif_top ontology @@ -29,20 +32,23 @@ def __init__(self, dicfile, output, cif_top='cif_top.ttl', self.top.sync_python_names() # Create new ontology - self.onto = self.world.get_ontology(iri) + self.onto = self.world.get_ontology(base_iri) self.onto.imported_ontologies.append(self.top) - def generate(self, dicts=None): - """Generate ontology.""" - if dicts is None: - dicts = self.cf.keys() - for dicname in dicts: + def generate(self, dics=None): + """Generate ontology for the given sequence of CIF dictionary names. + By default the dictionaries are inferred from the `dicfile`.""" + if dics is None: + dics = self.cf.keys() + for dicname in dics: self._generate_dic(dicname) return self.onto def _generate_dic(self, dicname): """Generate ontology for dictionary `name`.""" - # Add categories + # Add categories first so they are available when we add data items. + # A category seems to be characterised by having a _definition.scope + # attribute. for item in self.cf.get_children(dicname): if '_definition.scope' in item: self._add_category(item) @@ -111,7 +117,8 @@ def main(): 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' 'cif_core.dic', 'cif_core.dic') - gen = Generator(dicfile='cif_core.dic', output='cif_core.ttl') + gen = Generator(dicfile='cif_core.dic', + base_iri='http://emmo.info/crystallography/cif_core#') onto = gen.generate() # Annotate ontology From f7f63957e6fd088c6790e51f73775e29e2140e9b Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 18:22:40 +0100 Subject: [PATCH 10/17] Added annotations for units and aliases + exposing some variables for debugging --- .gitignore | 4 ++++ generate_cif.py | 30 +++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index dd6641f..86034ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ *~ old +ddl.dic cif_core.dic +templ_attr.cif +templ_enum.cif + cif_core.ttl diff --git a/generate_cif.py b/generate_cif.py index caa727b..40eff2c 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -86,6 +86,8 @@ def _add_data_item(self, item): """Add data item.""" name = item['_definition.id'] descr = item.get('_description.text') + units = item.get('_units.code') + aliases = item.get('_alias.definition_id') category_name = item['_name.category_id'].upper() row_name = '_%s_ROW' % item['_name.category_id'] if category_name in self.onto: @@ -98,12 +100,15 @@ def _add_data_item(self, item): else: category.disjoint_unions.append([e]) e.prefLabel.append(name.lstrip('_')) + if aliases: + e.altLabel.extend(aliases) if descr: e.comment.append(textwrap.dedent(descr)) + if units: + e._unit.append(units) if row_name in self.onto: row = self.onto[row_name] row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) - else: print('** no row:', name) else: @@ -111,11 +116,12 @@ def _add_data_item(self, item): def main(): - # Download the CIF core dictionary to current directory - if not os.path.exists('cif_core.dic'): - urllib.request.urlretrieve( - 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' - 'cif_core.dic', 'cif_core.dic') + # Download the CIF dictionaries to current directory + baseurl = 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' + for dic in 'ddl.dic', 'cif_core.dic', 'templ_attr.cif', 'templ_enum.cif': + if not os.path.exists(dic): + print('downloading', dic) + urllib.request.urlretrieve(baseurl + dic, dic) gen = Generator(dicfile='cif_core.dic', base_iri='http://emmo.info/crystallography/cif_core#') @@ -131,6 +137,16 @@ def main(): onto.save('cif_core.ttl', overwrite=True) + return gen # XXX - just for debugging + if __name__ == '__main__': - main() + #main() + + # for debugging and testing... + self = gen = main() + top = self.top + onto = self.onto + items = self.cf.get_children('core_dic') + sid = items['space_group_symop.id'] + s = items['SPACE_GROUP_SYMOP'] From 49dd92efea4cd94f41d8b2733d2969c235a17a4d Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 21 Mar 2021 18:46:41 +0100 Subject: [PATCH 11/17] Added _name and made labels and comments localised. --- generate_cif.py | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/generate_cif.py b/generate_cif.py index 40eff2c..b75d6b6 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -7,9 +7,17 @@ import urllib.request from emmo import World +import owlready2 +from owlready2 import locstr + from CifFile import ReadCif +def en(s): + """Returns `s` converted to a localised string in english.""" + return locstr(s, lang='en') + + class Generator: """Class for generating CIF ontology from a CIF dictionary. @@ -70,13 +78,13 @@ def _add_category(self, item): with self.onto: if item.get('_definition.class') in ('Loop', 'Set'): table = types.new_class(lname + '_TABLE', (self.top.TABLE, )) - table.prefLabel.append(table.name.lstrip('_')) + table.prefLabel.append(en(table.name.lstrip('_'))) row = types.new_class(lname + '_ROW', (self.top.ROW, )) - row.prefLabel.append(row.name.lstrip('_')) + row.prefLabel.append(en(row.name.lstrip('_'))) cat = types.new_class(name, (self.top.CATEGORY, )) - cat.prefLabel.append(cat.name.lstrip('_')) + cat.prefLabel.append(en(cat.name.lstrip('_'))) if descr: - cat.comment.append(textwrap.dedent(descr)) + cat.comment.append(en(textwrap.dedent(descr))) table.is_a.append(self.top.hasSpatialDirectPart.some(row)) table.is_a.append(self.top.hasSpatialPart.only(cat)) else: @@ -99,13 +107,23 @@ def _add_data_item(self, item): category.disjoint_unions[0].append(e) else: category.disjoint_unions.append([e]) - e.prefLabel.append(name.lstrip('_')) + e.prefLabel.append(en(name.lstrip('_'))) + + # Hmm, _name is already used internally by owlready2.Ontology + # so `e._name.append(name)` won't work. + # We have to add the tripple the hard way... + o, d = owlready2.to_literal(name) # not localised + self.onto._set_data_triple_spod( + s=e.storid, + p=self.onto.world._props['_name'].storid, + o=o, d=d) + if aliases: - e.altLabel.extend(aliases) + e.altLabel.extend(en(a) for a in aliases) if descr: - e.comment.append(textwrap.dedent(descr)) + e.comment.append(en(textwrap.dedent(descr))) if units: - e._unit.append(units) + e._unit.append(units) # not localised if row_name in self.onto: row = self.onto[row_name] row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) From 8c339d9a1fa346052d567f47b7e453236fc9baf8 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Mon, 22 Mar 2021 00:48:21 +0100 Subject: [PATCH 12/17] Cleaned up crystallography.ttl and corrected the base_iri --- catalog-v001.xml | 12 ++- crystallography.ttl | 240 ++++++++++++++++++++++++++++++++------------ from-chemistry.ttl | 33 ------ generate_cif.py | 2 +- 4 files changed, 186 insertions(+), 101 deletions(-) delete mode 100644 from-chemistry.ttl diff --git a/catalog-v001.xml b/catalog-v001.xml index 1de9e7f..bf5a3c0 100644 --- a/catalog-v001.xml +++ b/catalog-v001.xml @@ -1,10 +1,12 @@ - - - - - + + + + + + diff --git a/crystallography.ttl b/crystallography.ttl index 2a40867..92cb0f3 100644 --- a/crystallography.ttl +++ b/crystallography.ttl @@ -1,4 +1,4 @@ -@prefix : . +@prefix : . @prefix isq: . @prefix owl: . @prefix rdf: . @@ -8,22 +8,22 @@ @prefix rdfs: . @prefix skos: . @prefix dcterms: . -@base . +@base . - rdf:type owl:Ontology ; - owl:versionIRI ; - owl:imports , - ; - dcterms:abstract """A toplevel crystallography ontology based on EMMO and the CIF core dictionary. + rdf:type owl:Ontology ; + owl:versionIRI ; + owl:imports , + ; + dcterms:abstract """A toplevel crystallography ontology based on EMMO and the CIF core dictionary. It is implemented as a formal language.""" ; - dcterms:license "Creative Commons BY 4.0" . + dcterms:license "Creative Commons BY 4.0" . ################################################################# # Annotation properties ################################################################# -### http://emmo.info/crystallography/crystallography#EMMO_eb6c14cd_f958_489a_8f1a_e9de7c056702 +### http://emmo.info/domain-crystallography/crystallography#EMMO_eb6c14cd_f958_489a_8f1a_e9de7c056702 :EMMO_eb6c14cd_f958_489a_8f1a_e9de7c056702 rdf:type owl:AnnotationProperty ; rdfs:comment """Label of corresponding entity in the core CIF dictionary. @@ -32,7 +32,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; rdfs:subPropertyOf rdfs:comment . -### http://emmo.info/crystallography/crystallography#EMMO_ece80b49_c611_4626_965f_5beb93159c7e +### http://emmo.info/domain-crystallography/crystallography#EMMO_ece80b49_c611_4626_965f_5beb93159c7e :EMMO_ece80b49_c611_4626_965f_5beb93159c7e rdf:type owl:AnnotationProperty ; rdfs:comment """URL to corresponding entity in the core CIF dictionary. @@ -41,19 +41,79 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; rdfs:subPropertyOf rdfs:seeAlso . +### http://emmo.info/emmo#EMMO_21ae69b4_235e_479d_8dd8_4f756f694c1b +emmo:EMMO_21ae69b4_235e_479d_8dd8_4f756f694c1b rdf:type owl:AnnotationProperty . + + +### http://emmo.info/emmo#EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 +emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 rdf:type owl:AnnotationProperty . + + +### http://emmo.info/emmo#EMMO_b432d2d5_25f4_4165_99c5_5935a7763c1a +emmo:EMMO_b432d2d5_25f4_4165_99c5_5935a7763c1a rdf:type owl:AnnotationProperty . + + +### http://emmo.info/emmo#EMMO_de178b12_5d35_4bca_8efa_a4193162571d +emmo:EMMO_de178b12_5d35_4bca_8efa_a4193162571d rdf:type owl:AnnotationProperty . + + +### http://emmo.info/emmo#EMMO_fe015383_afb3_44a6_ae86_043628697aa2 +emmo:EMMO_fe015383_afb3_44a6_ae86_043628697aa2 rdf:type owl:AnnotationProperty . + + +### http://purl.org/dc/terms/abstract +dcterms:abstract rdf:type owl:AnnotationProperty . + + +### http://purl.org/dc/terms/license +dcterms:license rdf:type owl:AnnotationProperty . + + +### http://www.w3.org/2002/07/owl#qualifiedCardinality +owl:qualifiedCardinality rdf:type owl:AnnotationProperty . + + +################################################################# +# Object Properties +################################################################# + +### http://emmo.info/emmo#EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 +emmo:EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 rdf:type owl:ObjectProperty . + + +### http://emmo.info/emmo#EMMO_9380ab64_0363_4804_b13f_3a8a94119a76 +emmo:EMMO_9380ab64_0363_4804_b13f_3a8a94119a76 rdf:type owl:ObjectProperty . + + +### http://emmo.info/emmo#EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe +emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe rdf:type owl:ObjectProperty . + + +### http://emmo.info/emmo#EMMO_e1097637_70d2_4895_973f_2396f04fa204 +emmo:EMMO_e1097637_70d2_4895_973f_2396f04fa204 rdf:type owl:ObjectProperty . + + +################################################################# +# Data properties +################################################################# + +### http://emmo.info/emmo#EMMO_23b579e1_8088_45b5_9975_064014026c42 +emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 rdf:type owl:DatatypeProperty . + + ################################################################# # Classes ################################################################# -### http://emmo.info/crystallography/crystallography#EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 +### http://emmo.info/domain-crystallography/crystallography#EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 :EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 rdf:type owl:Class ; - rdfs:subClassOf ; + rdfs:subClassOf emmo:EMMO_9fa966c7_5231_409e_841f_b4c5fd33732a ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "The union of Atom and Molecule." ; rdfs:comment "The word \"constituent\" means part of a whole. Within the crystallography domain, constituents are defined as the real-world building blocks of a crystal (i.e. atoms or molecules)." ; skos:prefLabel "Constituent"@en . -### http://emmo.info/crystallography/crystallography#EMMO_216efd86_d095_49db_bc74_c9f808577940 +### http://emmo.info/domain-crystallography/crystallography#EMMO_216efd86_d095_49db_bc74_c9f808577940 :EMMO_216efd86_d095_49db_bc74_c9f808577940 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef , @@ -68,7 +128,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "FractionalPositionB"@en . -### http://emmo.info/crystallography/crystallography#EMMO_290e4378_2cab_4d78_bc40_a08a84af4f76 +### http://emmo.info/domain-crystallography/crystallography#EMMO_290e4378_2cab_4d78_bc40_a08a84af4f76 :EMMO_290e4378_2cab_4d78_bc40_a08a84af4f76 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_f3dd74c0_f480_49e8_9764_33b78638c235 , @@ -82,7 +142,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "LatticeParameterBeta"@en . -### http://emmo.info/crystallography/crystallography#EMMO_35e0d181_d10b_45b8_9f8b_c12a56ae45e6 +### http://emmo.info/domain-crystallography/crystallography#EMMO_35e0d181_d10b_45b8_9f8b_c12a56ae45e6 :EMMO_35e0d181_d10b_45b8_9f8b_c12a56ae45e6 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_cd2cd0de_e0cc_4ef1_b27e_2e88db027bac , @@ -97,7 +157,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "LatticeParameterA"@en . -### http://emmo.info/crystallography/crystallography#EMMO_43b8c657_3fbf_4613_9fb3_0f3a377711a7 +### http://emmo.info/domain-crystallography/crystallography#EMMO_43b8c657_3fbf_4613_9fb3_0f3a377711a7 :EMMO_43b8c657_3fbf_4613_9fb3_0f3a377711a7 rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -107,7 +167,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "Hexagonal"@en . -### http://emmo.info/crystallography/crystallography#EMMO_49cbd126_1722_436e_a4bd_3363d141bb37 +### http://emmo.info/domain-crystallography/crystallography#EMMO_49cbd126_1722_436e_a4bd_3363d141bb37 :EMMO_49cbd126_1722_436e_a4bd_3363d141bb37 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef , [ rdf:type owl:Restriction ; @@ -120,7 +180,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "Occupancy"@en . -### http://emmo.info/crystallography/crystallography#EMMO_4f586c18_897b_4568_94b8_3960592c1438 +### http://emmo.info/domain-crystallography/crystallography#EMMO_4f586c18_897b_4568_94b8_3960592c1438 :EMMO_4f586c18_897b_4568_94b8_3960592c1438 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_f3dd74c0_f480_49e8_9764_33b78638c235 , @@ -134,7 +194,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "LatticeParameterAlpha"@en . -### http://emmo.info/crystallography/crystallography#EMMO_5ab885af_eff7_4cc7_954c_cf107c54735b +### http://emmo.info/domain-crystallography/crystallography#EMMO_5ab885af_eff7_4cc7_954c_cf107c54735b :EMMO_5ab885af_eff7_4cc7_954c_cf107c54735b rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_ba882f34_0d71_4e4f_9d92_0c076c633a2c , [ rdf:type owl:Restriction ; @@ -147,7 +207,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "SymmetryMultiplicity"@en . -### http://emmo.info/crystallography/crystallography#EMMO_6028825a_008a_4163_96fb_0af1bdc15695 +### http://emmo.info/domain-crystallography/crystallography#EMMO_6028825a_008a_4163_96fb_0af1bdc15695 :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 rdf:type owl:Class ; owl:equivalentClass [ owl:intersectionOf ( :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 emmo:EMMO_a1083d0a_c1fb_471f_8e20_a98f881ad527 @@ -164,18 +224,18 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "CrystallographicSymbol"@en . -### http://emmo.info/crystallography/crystallography#EMMO_69dab453_6596_464d_a21d_d64643f4ed9b +### http://emmo.info/domain-crystallography/crystallography#EMMO_69dab453_6596_464d_a21d_d64643f4ed9b :EMMO_69dab453_6596_464d_a21d_d64643f4ed9b rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_a2b006f2_bbfd_4dba_bcaa_3fca20cd6be1 , [ rdf:type owl:Restriction ; - owl:onProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe ; - owl:someValuesFrom + owl:onProperty emmo:EMMO_f68030be_94b8_4c61_a161_886468558054 ; + owl:someValuesFrom :EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 ] ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A crystal is a solid whos constituents are ordered." ; skos:prefLabel "Crystal"@en . -### http://emmo.info/crystallography/crystallography#EMMO_6a340d67_c6cb_4348_8537_d9aa0e768721 +### http://emmo.info/domain-crystallography/crystallography#EMMO_6a340d67_c6cb_4348_8537_d9aa0e768721 :EMMO_6a340d67_c6cb_4348_8537_d9aa0e768721 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , [ rdf:type owl:Restriction ; @@ -201,7 +261,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "CrystalStructure"@en . -### http://emmo.info/crystallography/crystallography#EMMO_6b5e88c8_0d54_4a02_a9ff_6958f6013e0e +### http://emmo.info/domain-crystallography/crystallography#EMMO_6b5e88c8_0d54_4a02_a9ff_6958f6013e0e :EMMO_6b5e88c8_0d54_4a02_a9ff_6958f6013e0e rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_44da6d75_54a4_4aa8_bd3a_156f6e9abb8e ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A vector connecting two lattice sites, where the lattice sites defines the periodic structure of a crystal." ; @@ -209,7 +269,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "LatticeVector"@en . -### http://emmo.info/crystallography/crystallography#EMMO_6c4a12db_98bd_4dd8_bb90_8801096b5fd0 +### http://emmo.info/domain-crystallography/crystallography#EMMO_6c4a12db_98bd_4dd8_bb90_8801096b5fd0 :EMMO_6c4a12db_98bd_4dd8_bb90_8801096b5fd0 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_ba882f34_0d71_4e4f_9d92_0c076c633a2c , [ rdf:type owl:Restriction ; @@ -229,7 +289,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "SpacegroupNumber"@en . -### http://emmo.info/crystallography/crystallography#EMMO_6d9fe189_71fb_4af7_a991_a028bb90f18b +### http://emmo.info/domain-crystallography/crystallography#EMMO_6d9fe189_71fb_4af7_a991_a028bb90f18b :EMMO_6d9fe189_71fb_4af7_a991_a028bb90f18b rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -239,14 +299,14 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "Trigonal"@en . -### http://emmo.info/crystallography/crystallography#EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 +### http://emmo.info/domain-crystallography/crystallography#EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_d8d2144e_5c8d_455d_a643_5caf4d8d9df8 ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "The symbolic object defining the basis for crystallography." ; skos:prefLabel "Crystallographical"@en . -### http://emmo.info/crystallography/crystallography#EMMO_79c5bbf6_7429_44c6_a70d_0d3c461b6375 +### http://emmo.info/domain-crystallography/crystallography#EMMO_79c5bbf6_7429_44c6_a70d_0d3c461b6375 :EMMO_79c5bbf6_7429_44c6_a70d_0d3c461b6375 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , [ rdf:type owl:Restriction ; @@ -269,7 +329,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "UnitCell"@en . -### http://emmo.info/crystallography/crystallography#EMMO_7d6d49ac_18d2_4c98_b16d_621877272989 +### http://emmo.info/domain-crystallography/crystallography#EMMO_7d6d49ac_18d2_4c98_b16d_621877272989 :EMMO_7d6d49ac_18d2_4c98_b16d_621877272989 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_cd2cd0de_e0cc_4ef1_b27e_2e88db027bac , @@ -284,7 +344,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "LatticeParameterB"@en . -### http://emmo.info/crystallography/crystallography#EMMO_8411829d_faba_479a_8d37_d961dc41c9ce +### http://emmo.info/domain-crystallography/crystallography#EMMO_8411829d_faba_479a_8d37_d961dc41c9ce :EMMO_8411829d_faba_479a_8d37_d961dc41c9ce rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_1cba0b27_15d0_4326_933f_379d0b3565b6 , [ rdf:type owl:Restriction ; @@ -295,7 +355,7 @@ See https://www.iucr.org/resources/cif/dictionaries/cif_core""" ; skos:prefLabel "Shape3x3Matrix"@en . -### http://emmo.info/crystallography/crystallography#EMMO_931eb95d_d8ee_41c4_93ae_3d22df839bce +### http://emmo.info/domain-crystallography/crystallography#EMMO_931eb95d_d8ee_41c4_93ae_3d22df839bce :EMMO_931eb95d_d8ee_41c4_93ae_3d22df839bce rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , [ rdf:type owl:Restriction ; @@ -315,7 +375,7 @@ That is to say, it is necessary to list explicitly all the symmetry operations r skos:prefLabel "SymmetryOperationString"@en . -### http://emmo.info/crystallography/crystallography#EMMO_971a2a1d_d923_47ac_9315_2187e7594542 +### http://emmo.info/domain-crystallography/crystallography#EMMO_971a2a1d_d923_47ac_9315_2187e7594542 :EMMO_971a2a1d_d923_47ac_9315_2187e7594542 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_f1a51559_aa3d_43a0_9327_918039f0dfed ; @@ -325,7 +385,7 @@ That is to say, it is necessary to list explicitly all the symmetry operations r skos:prefLabel "CellVolume"@en . -### http://emmo.info/crystallography/crystallography#EMMO_97fae38b_87db_4cc2_9b06_87df1ec09c84 +### http://emmo.info/domain-crystallography/crystallography#EMMO_97fae38b_87db_4cc2_9b06_87df1ec09c84 :EMMO_97fae38b_87db_4cc2_9b06_87df1ec09c84 rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -335,7 +395,7 @@ That is to say, it is necessary to list explicitly all the symmetry operations r skos:prefLabel "Triclinic"@en . -### http://emmo.info/crystallography/crystallography#EMMO_987e01f4_da01_4e15_9620_e3c814a48e64 +### http://emmo.info/domain-crystallography/crystallography#EMMO_987e01f4_da01_4e15_9620_e3c814a48e64 :EMMO_987e01f4_da01_4e15_9620_e3c814a48e64 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_cd2cd0de_e0cc_4ef1_b27e_2e88db027bac , @@ -350,7 +410,7 @@ That is to say, it is necessary to list explicitly all the symmetry operations r skos:prefLabel "LatticeParameterC"@en . -### http://emmo.info/crystallography/crystallography#EMMO_9bb4432f_b2b5_4de5_9a54_27c427062f76 +### http://emmo.info/domain-crystallography/crystallography#EMMO_9bb4432f_b2b5_4de5_9a54_27c427062f76 :EMMO_9bb4432f_b2b5_4de5_9a54_27c427062f76 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_ba882f34_0d71_4e4f_9d92_0c076c633a2c , [ rdf:type owl:Restriction ; @@ -370,7 +430,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "SpacegroupSettingNumber"@en . -### http://emmo.info/crystallography/crystallography#EMMO_a83504f1_b203_40f9_9379_23f0c0b61be0 +### http://emmo.info/domain-crystallography/crystallography#EMMO_a83504f1_b203_40f9_9379_23f0c0b61be0 :EMMO_a83504f1_b203_40f9_9379_23f0c0b61be0 rdf:type owl:Class ; rdfs:subClassOf :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 , [ rdf:type owl:Restriction ; @@ -387,7 +447,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "Species"@en . -### http://emmo.info/crystallography/crystallography#EMMO_afd5401b_0b6d_4c4d_8559_e84473cc08ec +### http://emmo.info/domain-crystallography/crystallography#EMMO_afd5401b_0b6d_4c4d_8559_e84473cc08ec :EMMO_afd5401b_0b6d_4c4d_8559_e84473cc08ec rdf:type owl:Class ; rdfs:subClassOf :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 ; :EMMO_eb6c14cd_f958_489a_8f1a_e9de7c056702 "_atom_site_label" ; @@ -395,7 +455,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "SiteLabel"@en . -### http://emmo.info/crystallography/crystallography#EMMO_b2b8e17f_c6d0_4bdf_94f8_ebf7870df669 +### http://emmo.info/domain-crystallography/crystallography#EMMO_b2b8e17f_c6d0_4bdf_94f8_ebf7870df669 :EMMO_b2b8e17f_c6d0_4bdf_94f8_ebf7870df669 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef , @@ -410,7 +470,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "FractionalPositionA"@en . -### http://emmo.info/crystallography/crystallography#EMMO_b5a8a6b3_ffd7_4783_a097_098d47a225c5 +### http://emmo.info/domain-crystallography/crystallography#EMMO_b5a8a6b3_ffd7_4783_a097_098d47a225c5 :EMMO_b5a8a6b3_ffd7_4783_a097_098d47a225c5 rdf:type owl:Class ; rdfs:subClassOf :EMMO_8411829d_faba_479a_8d37_d961dc41c9ce ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A rotation matrix."@en ; @@ -418,7 +478,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "RotationMatrix"@en . -### http://emmo.info/crystallography/crystallography#EMMO_b7bc9c85_801b_44c8_a7ad_fe8a52b593c4 +### http://emmo.info/domain-crystallography/crystallography#EMMO_b7bc9c85_801b_44c8_a7ad_fe8a52b593c4 :EMMO_b7bc9c85_801b_44c8_a7ad_fe8a52b593c4 rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -428,7 +488,7 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "Cubic"@en . -### http://emmo.info/crystallography/crystallography#EMMO_bb8a0a34_25dd_4262_b264_8750f6acc2b8 +### http://emmo.info/domain-crystallography/crystallography#EMMO_bb8a0a34_25dd_4262_b264_8750f6acc2b8 :EMMO_bb8a0a34_25dd_4262_b264_8750f6acc2b8 rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -438,14 +498,14 @@ The setting number does not appear in the CIF core dictionary, but is included i skos:prefLabel "Tetragonal"@en . -### http://emmo.info/crystallography/crystallography#EMMO_bf4315d5_0a42_44c1_917e_9057789ea798 +### http://emmo.info/domain-crystallography/crystallography#EMMO_bf4315d5_0a42_44c1_917e_9057789ea798 :EMMO_bf4315d5_0a42_44c1_917e_9057789ea798 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_2ff07b07_c447_490f_903a_f6a72a12d7bf ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A translation vector."@en ; skos:prefLabel "TranslationVector"@en . -### http://emmo.info/crystallography/crystallography#EMMO_c70c483e_8e3c_4fd4_97eb_bf9ae3981a01 +### http://emmo.info/domain-crystallography/crystallography#EMMO_c70c483e_8e3c_4fd4_97eb_bf9ae3981a01 :EMMO_c70c483e_8e3c_4fd4_97eb_bf9ae3981a01 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_54ee6b5e_5261_44a8_86eb_5717e7fdb9d0 , [ rdf:type owl:Restriction ; @@ -465,7 +525,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "SymmetryOperation"@en . -### http://emmo.info/crystallography/crystallography#EMMO_cd9c28a0_9453_494c_b45e_27eaf3d785e7 +### http://emmo.info/domain-crystallography/crystallography#EMMO_cd9c28a0_9453_494c_b45e_27eaf3d785e7 :EMMO_cd9c28a0_9453_494c_b45e_27eaf3d785e7 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef , [ rdf:type owl:Restriction ; @@ -492,7 +552,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "FractionalPosition"@en . -### http://emmo.info/crystallography/crystallography#EMMO_d24f1b42_2767_4096_900b_bf7c9608c7de +### http://emmo.info/domain-crystallography/crystallography#EMMO_d24f1b42_2767_4096_900b_bf7c9608c7de :EMMO_d24f1b42_2767_4096_900b_bf7c9608c7de rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -503,7 +563,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "Orthorhombic"@en . -### http://emmo.info/crystallography/crystallography#EMMO_d6ea1aa1_fe6e_4fbb_bfad_e848fb02a969 +### http://emmo.info/domain-crystallography/crystallography#EMMO_d6ea1aa1_fe6e_4fbb_bfad_e848fb02a969 :EMMO_d6ea1aa1_fe6e_4fbb_bfad_e848fb02a969 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_f3dd74c0_f480_49e8_9764_33b78638c235 , @@ -517,7 +577,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "LatticeParameterGamma"@en . -### http://emmo.info/crystallography/crystallography#EMMO_e2a89e11_0cab_40c6_9e0b_a391585255c6 +### http://emmo.info/domain-crystallography/crystallography#EMMO_e2a89e11_0cab_40c6_9e0b_a391585255c6 :EMMO_e2a89e11_0cab_40c6_9e0b_a391585255c6 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef , @@ -532,7 +592,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "FractionalPositionC"@en . -### http://emmo.info/crystallography/crystallography#EMMO_e30a1c29_783b_45eb_ac06_1e54f99a2eb9 +### http://emmo.info/domain-crystallography/crystallography#EMMO_e30a1c29_783b_45eb_ac06_1e54f99a2eb9 :EMMO_e30a1c29_783b_45eb_ac06_1e54f99a2eb9 rdf:type owl:Class ; rdfs:subClassOf [ rdf:type owl:Restriction ; owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ; @@ -543,7 +603,7 @@ Mathematically it is described by a rotation followed by a translation."""@en ; skos:prefLabel "Monoclinic"@en . -### http://emmo.info/crystallography/crystallography#EMMO_e3b30772_419b_49f4_a401_7f536bd4c9e6 +### http://emmo.info/domain-crystallography/crystallography#EMMO_e3b30772_419b_49f4_a401_7f536bd4c9e6 :EMMO_e3b30772_419b_49f4_a401_7f536bd4c9e6 rdf:type owl:Class ; rdfs:subClassOf :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 , [ rdf:type owl:Restriction ; @@ -561,7 +621,7 @@ References: skos:prefLabel "HallSymbol"@en . -### http://emmo.info/crystallography/crystallography#EMMO_e7aa6a92_c28d_457c_be2c_0ac16c8306c0 +### http://emmo.info/domain-crystallography/crystallography#EMMO_e7aa6a92_c28d_457c_be2c_0ac16c8306c0 :EMMO_e7aa6a92_c28d_457c_be2c_0ac16c8306c0 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 ; owl:disjointUnionOf ( :EMMO_290e4378_2cab_4d78_bc40_a08a84af4f76 @@ -575,7 +635,7 @@ References: skos:prefLabel "LatticeParameter"@en . -### http://emmo.info/crystallography/crystallography#EMMO_ea30edf8_be85_4b92_a649_1cedb3bab550 +### http://emmo.info/domain-crystallography/crystallography#EMMO_ea30edf8_be85_4b92_a649_1cedb3bab550 :EMMO_ea30edf8_be85_4b92_a649_1cedb3bab550 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , [ rdf:type owl:Restriction ; @@ -613,7 +673,7 @@ References: skos:prefLabel "Site"@en . -### http://emmo.info/crystallography/crystallography#EMMO_f03acd96_b5ba_4921_9ae7_80e76d27e853 +### http://emmo.info/domain-crystallography/crystallography#EMMO_f03acd96_b5ba_4921_9ae7_80e76d27e853 :EMMO_f03acd96_b5ba_4921_9ae7_80e76d27e853 rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 , [ rdf:type owl:Restriction ; @@ -650,7 +710,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "Spacegroup"@en . -### http://emmo.info/crystallography/crystallography#EMMO_f12310ea_4957_49cb_8ff0_1d13849de166 +### http://emmo.info/domain-crystallography/crystallography#EMMO_f12310ea_4957_49cb_8ff0_1d13849de166 :EMMO_f12310ea_4957_49cb_8ff0_1d13849de166 rdf:type owl:Class ; rdfs:subClassOf :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 , [ rdf:type owl:Restriction ; @@ -664,7 +724,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "WyckoffSymbol"@en . -### http://emmo.info/crystallography/crystallography#EMMO_f3295691_a01e_4454_a40e_35903ad93485 +### http://emmo.info/domain-crystallography/crystallography#EMMO_f3295691_a01e_4454_a40e_35903ad93485 :EMMO_f3295691_a01e_4454_a40e_35903ad93485 rdf:type owl:Class ; rdfs:subClassOf :EMMO_6028825a_008a_4163_96fb_0af1bdc15695 , [ rdf:type owl:Restriction ; @@ -679,7 +739,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "HermannMauguinSymbol"@en . -### http://emmo.info/crystallography/crystallography#EMMO_fcd69e5c_cc4a_4db8_b157_3f437c3cfdff +### http://emmo.info/domain-crystallography/crystallography#EMMO_fcd69e5c_cc4a_4db8_b157_3f437c3cfdff :EMMO_fcd69e5c_cc4a_4db8_b157_3f437c3cfdff rdf:type owl:Class ; rdfs:subClassOf :EMMO_79c5bbf6_7429_44c6_a70d_0d3c461b6375 ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "The smallest unit cell that contains the same point group symmetries as the overall lattice."@en ; @@ -687,7 +747,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "ConventionalUnitCell"@en . -### http://emmo.info/crystallography/crystallography#EMMO_fd642120_d36d_4e3b_bdf2_2cd9acb4995c +### http://emmo.info/domain-crystallography/crystallography#EMMO_fd642120_d36d_4e3b_bdf2_2cd9acb4995c :EMMO_fd642120_d36d_4e3b_bdf2_2cd9acb4995c rdf:type owl:Class ; rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 ; owl:disjointUnionOf ( :EMMO_43b8c657_3fbf_4613_9fb3_0f3a377711a7 @@ -704,7 +764,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "CrystalSystem"@en . -### http://emmo.info/crystallography/crystallography#EMMO_fdfa5395_9c32_4a7b_a15a_f6fa015662d4 +### http://emmo.info/domain-crystallography/crystallography#EMMO_fdfa5395_9c32_4a7b_a15a_f6fa015662d4 :EMMO_fdfa5395_9c32_4a7b_a15a_f6fa015662d4 rdf:type owl:Class ; rdfs:subClassOf :EMMO_79c5bbf6_7429_44c6_a70d_0d3c461b6375 ; emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A unit cell that contains exactly one lattice point. It is the smallest possible cell." ; @@ -712,16 +772,72 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel skos:prefLabel "PrimitiveUnitCell"@en . +### http://emmo.info/emmo#EMMO_18d180e4_5e3e_42f7_820c_e08951223486 +emmo:EMMO_18d180e4_5e3e_42f7_820c_e08951223486 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_1cba0b27_15d0_4326_933f_379d0b3565b6 +emmo:EMMO_1cba0b27_15d0_4326_933f_379d0b3565b6 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_2ff07b07_c447_490f_903a_f6a72a12d7bf +emmo:EMMO_2ff07b07_c447_490f_903a_f6a72a12d7bf rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_44da6d75_54a4_4aa8_bd3a_156f6e9abb8e +emmo:EMMO_44da6d75_54a4_4aa8_bd3a_156f6e9abb8e rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_54ee6b5e_5261_44a8_86eb_5717e7fdb9d0 +emmo:EMMO_54ee6b5e_5261_44a8_86eb_5717e7fdb9d0 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_a1083d0a_c1fb_471f_8e20_a98f881ad527 +emmo:EMMO_a1083d0a_c1fb_471f_8e20_a98f881ad527 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_a2b006f2_bbfd_4dba_bcaa_3fca20cd6be1 +emmo:EMMO_a2b006f2_bbfd_4dba_bcaa_3fca20cd6be1 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_ba882f34_0d71_4e4f_9d92_0c076c633a2c +emmo:EMMO_ba882f34_0d71_4e4f_9d92_0c076c633a2c rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_cd2cd0de_e0cc_4ef1_b27e_2e88db027bac +emmo:EMMO_cd2cd0de_e0cc_4ef1_b27e_2e88db027bac rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_d8d2144e_5c8d_455d_a643_5caf4d8d9df8 +emmo:EMMO_d8d2144e_5c8d_455d_a643_5caf4d8d9df8 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_f1a51559_aa3d_43a0_9327_918039f0dfed +emmo:EMMO_f1a51559_aa3d_43a0_9327_918039f0dfed rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_f3dd74c0_f480_49e8_9764_33b78638c235 +emmo:EMMO_f3dd74c0_f480_49e8_9764_33b78638c235 rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_f8bd64d5_5d3e_4ad4_a46e_c30714fecb7f +emmo:EMMO_f8bd64d5_5d3e_4ad4_a46e_c30714fecb7f rdf:type owl:Class . + + +### http://emmo.info/emmo#EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef +emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef rdf:type owl:Class . + + [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger +[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger +[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger ] . [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger @@ -739,7 +855,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger +[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger @@ -754,7 +870,7 @@ The commonly used Hermann-Mauguin symbol determines the space-group type uniquel [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger +[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger ] . ### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/from-chemistry.ttl b/from-chemistry.ttl deleted file mode 100644 index 9b1e163..0000000 --- a/from-chemistry.ttl +++ /dev/null @@ -1,33 +0,0 @@ -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@base . - - rdf:type owl:Ontology . - -################################################################# -# Annotation properties -################################################################# - -### http://www.w3.org/2004/02/skos/core#prefLabel - rdf:type owl:AnnotationProperty . - - -################################################################# -# Classes -################################################################# - -### http://emmo.info/emmo/from-chemistry#EMMO_9fa966c7_5231_409e_841f_b4c5fd33732a -:EMMO_9fa966c7_5231_409e_841f_b4c5fd33732a rdf:type owl:Class ; - "PolyAtomicEntity"@en . - - -### http://emmo.info/emmo/from-chemistry#EMMO_7fbb787b_cbcf8fe6_6da6_49e0_ab4d_00f737ea9689 -:EMMO_7fbb787b_cbcf8fe6_6da6_49e0_ab4d_00f737ea9689 rdf:type owl:Class ; - "ChemicalSpecies"@en . - - -### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/generate_cif.py b/generate_cif.py index b75d6b6..5711b78 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -142,7 +142,7 @@ def main(): urllib.request.urlretrieve(baseurl + dic, dic) gen = Generator(dicfile='cif_core.dic', - base_iri='http://emmo.info/crystallography/cif_core#') + base_iri='http://emmo.info/domain-crystallography/cif_core#') onto = gen.generate() # Annotate ontology From b469ad846f23f79a92559b5ecb7a5ff5ef4cc517 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 25 Mar 2021 08:54:04 +0100 Subject: [PATCH 13/17] Linked crystallography to cif_core --- crystallography.ttl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/crystallography.ttl b/crystallography.ttl index 92cb0f3..1fd316a 100644 --- a/crystallography.ttl +++ b/crystallography.ttl @@ -77,6 +77,14 @@ owl:qualifiedCardinality rdf:type owl:AnnotationProperty . # Object Properties ################################################################# +### http://emmo.info/domain-crystallography/cif_top#hasSpatialDirectPart + owl:equivalentProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe . + + +### http://emmo.info/domain-crystallography/cif_top#hasSpatialPart + owl:equivalentProperty emmo:EMMO_f68030be_94b8_4c61_a161_886468558054 . + + ### http://emmo.info/emmo#EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 emmo:EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 rdf:type owl:ObjectProperty . @@ -93,6 +101,8 @@ emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe rdf:type owl:ObjectProperty . emmo:EMMO_e1097637_70d2_4895_973f_2396f04fa204 rdf:type owl:ObjectProperty . +### http://emmo.info/emmo#EMMO_f68030be_94b8_4c61_a161_886468558054 + ################################################################# # Data properties ################################################################# @@ -105,6 +115,10 @@ emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 rdf:type owl:DatatypeProperty . # Classes ################################################################# +### http://emmo.info/domain-crystallography/cif_top#CIF + rdfs:subClassOf :EMMO_78a3d6f9_0bbd_4b44_a9a9_baf3df276a06 . + + ### http://emmo.info/domain-crystallography/crystallography#EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 :EMMO_203692d9_4bf0_45ae_b4eb_9dc02adae605 rdf:type owl:Class ; rdfs:subClassOf emmo:EMMO_9fa966c7_5231_409e_841f_b4c5fd33732a ; @@ -831,9 +845,6 @@ emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef rdf:type owl:Class . [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger - ] . - [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . @@ -867,10 +878,13 @@ emmo:EMMO_faab3f84_e475_4a46_af9c_7d249f0b9aef rdf:type owl:Class . [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . +[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger + ] . + [ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . -[ owl:qualifiedCardinality "3"^^xsd:nonNegativeInteger +[ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ] . ### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi From 33b6b713f7869d834b4a1a53c4b7643aa97584eb Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Mon, 29 Mar 2021 23:19:11 +0200 Subject: [PATCH 14/17] Cleaned up. --- cif_top.ttl | 304 +++++++++++++++++++++++++++++++++++++++++------- generate_cif.py | 123 +++++++++++--------- 2 files changed, 333 insertions(+), 94 deletions(-) diff --git a/cif_top.ttl b/cif_top.ttl index f86ef0d..24525a7 100644 --- a/cif_top.ttl +++ b/cif_top.ttl @@ -25,6 +25,12 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail # Annotation properties ################################################################# +### http://emmo.info/domain-crystallography/cif_top#_dimension +:_dimension rdf:type owl:AnnotationProperty ; + rdfs:comment "Size of an Array/Matrix/List expressed as a text string. The text string itself consists of zero or more non-negative integers separated by commas placed within bounding square brackets. Empty square brackets represent a list of unknown size."@en ; + skos:prefLabel "_dimension"@en . + + ### http://emmo.info/domain-crystallography/cif_top#_name :_name rdf:type owl:AnnotationProperty ; rdfs:comment "Name associated with a data item."@en ; @@ -101,37 +107,75 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; # Data properties ################################################################# +### http://emmo.info/domain-crystallography/cif_top#hasDateTimeData +:hasDateTimeData rdf:type owl:DatatypeProperty ; + rdfs:range xsd:dateTime ; + rdfs:comment "hasDateTimeData"@en . + + ### http://emmo.info/domain-crystallography/cif_top#hasFloatData :hasFloatData rdf:type owl:DatatypeProperty ; - rdfs:subPropertyOf owl:topDataProperty ; - rdfs:domain :_numb ; + rdfs:subPropertyOf :hasNumericalData ; rdfs:range xsd:double ; skos:prefLabel "hasFloatData"@en . +### http://emmo.info/domain-crystallography/cif_top#hasIntegerData +:hasIntegerData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf :hasNumericalData ; + rdfs:range xsd:integer ; + skos:prefLabel "hasIntegerData"@en . + + +### http://emmo.info/domain-crystallography/cif_top#hasNumericalData +:hasNumericalData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + skos:prefLabel "hasNumericalData"@en . + + ### http://emmo.info/domain-crystallography/cif_top#hasSymbolData :hasSymbolData rdf:type owl:DatatypeProperty ; rdfs:subPropertyOf owl:topDataProperty ; - rdfs:domain :_char ; rdfs:range xsd:string ; skos:prefLabel "hasSymbolData"@en . -### http://emmo.info/domain-crystallography/cif_top#hasUncertaintyData -:hasUncertaintyData rdf:type owl:DatatypeProperty ; - rdfs:subPropertyOf :hasFloatData ; - rdfs:comment "Optional uncertainty associated to a CIF numb data type."@en ; - skos:prefLabel "hasUncertaintyData"@en . +### http://emmo.info/domain-crystallography/cif_top#hasUriData +:hasUriData rdf:type owl:DatatypeProperty ; + rdfs:subPropertyOf owl:topDataProperty ; + rdfs:range xsd:anyURI ; + skos:prefLabel "hasUriData"@en . ################################################################# # Classes ################################################################# +### http://emmo.info/domain-crystallography/cif_top#Array +:Array rdf:type owl:Class ; + rdfs:subClassOf :DATA_VALUE , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialPart ; + owl:someValuesFrom :Single + ] ; + rdfs:comment "Ordered set of values of the same type. Operations across arrays are equivalent to operations across elements of the Array."@en ; + skos:prefLabel "Array"@en . + + +### http://emmo.info/domain-crystallography/cif_top#ByReference +:ByReference rdf:type owl:Class ; + rdfs:subClassOf :Text ; + rdfs:comment "The contents have the same form as those of the attribute referenced by '_type.contents_referenced_id'."@en ; + skos:prefLabel "ByReference"@en . + + ### http://emmo.info/domain-crystallography/cif_top#CATEGORY :CATEGORY rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT ; - rdfs:comment "A classification of tables and its parts."@en ; + rdfs:comment """A superclass of CIF categories used to categorize data items. + +Only data items belonging to the same category can be placed in the same table."""@en ; + skos:altLabel "CIF_CATEGORIZED"@en ; skos:prefLabel "CATEGORY"@en . @@ -168,11 +212,40 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; rdfs:subClassOf :DATA_ITEMS , [ rdf:type owl:Restriction ; owl:onProperty :hasSpatialDirectPart ; - owl:someValuesFrom :_type + owl:someValuesFrom :DATA_VALUE ] ; skos:prefLabel "COLUMN"@en . +### http://emmo.info/domain-crystallography/cif_top#Code +:Code rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSymbolData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:string + ] ; + rdfs:comment "Case-insensitive sequence of CIF2 characters containing no ASCII whitespace."@en ; + skos:prefLabel "Code"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Complex +:Complex rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :Imag + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onClass :Real + ] ; + rdfs:comment "A complex number."@en ; + skos:prefLabel "Complex"@en . + + ### http://emmo.info/domain-crystallography/cif_top#DATA_ITEMS :DATA_ITEMS rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT ; @@ -180,6 +253,14 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "DATA_ITEMS"@en . +### http://emmo.info/domain-crystallography/cif_top#DATA_VALUE +:DATA_VALUE rdf:type owl:Class ; + rdfs:subClassOf :DDL_CONCEPT ; + rdfs:comment "Data items correspond to a type. Its individuals are the actual data strings or numbers."@en ; + skos:altLabel "_type"@en ; + skos:prefLabel "DATA_VALUE"@en . + + ### http://emmo.info/domain-crystallography/cif_top#DDL_CONCEPT :DDL_CONCEPT rdf:type owl:Class ; rdfs:subClassOf :CIF ; @@ -187,10 +268,88 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; skos:prefLabel "DDL_CONCEPT"@en . -### http://emmo.info/domain-crystallography/cif_top#FUNCTION -:FUNCTION rdf:type owl:Class ; - rdfs:subClassOf :DATA_ITEMS ; - skos:prefLabel "FUNCTION"@en . +### http://emmo.info/domain-crystallography/cif_top#Date +:Date rdf:type owl:Class ; + rdfs:subClassOf :Datetime ; + rdfs:comment "ISO standard date format --
."@en ; + owl:deprecated "Use DateTime for all new dictionaries."@en ; + skos:prefLabel "Date"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Datetime +:Datetime rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasDateTimeData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:dateTime + ] ; + rdfs:comment "A timestamp. Text formats must use date-time or full-date productions of RFC 3339 ABNF."@en ; + skos:prefLabel "Datetime"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Dimension +:Dimension rdf:type owl:Class ; + rdfs:subClassOf :Text ; + rdfs:comment """Size of an Array/Matrix/List expressed as a text string. + +The text string itself consists of zero or more non-negative integers separated by commas placed within bounding square brackets. Empty square brackets represent a list of unknown size."""@en ; + skos:prefLabel "Dimension"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Imag +:Imag rdf:type owl:Class ; + rdfs:subClassOf :Real ; + rdfs:comment "Floating-point imaginary number."@en ; + skos:prefLabel "Imag"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Implied +:Implied rdf:type owl:Class ; + rdfs:subClassOf :Single ; + rdfs:comment "Implied by the context of the attribute."@en ; + skos:prefLabel "Implied"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Integer +:Integer rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasIntegerData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:integer + ] ; + rdfs:comment "Positive or negative integer number."@en ; + skos:prefLabel "Integer"@en . + + +### http://emmo.info/domain-crystallography/cif_top#List +:List rdf:type owl:Class ; + rdfs:subClassOf :DATA_VALUE , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:someValuesFrom :Single + ] ; + rdfs:comment "Ordered set of values. Elements need not be of same contents type."@en ; + skos:prefLabel "List"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Matrix +:Matrix rdf:type owl:Class ; + rdfs:subClassOf :DATA_VALUE , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialPart ; + owl:someValuesFrom :Single + ] ; + rdfs:comment "Ordered set of numerical values for a tensor. Tensor operations such as dot and cross products, are valid cross matrix objects. A matrix with a single dimension is interpreted as a row or column vector as required."@en ; + skos:prefLabel "Matrix"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Name +:Name rdf:type owl:Class ; + rdfs:subClassOf :Code ; + rdfs:comment "Case-insensitive sequence of ASCII alpha-numeric characters or underscore."@en ; + skos:prefLabel "Name"@en . ### http://emmo.info/domain-crystallography/cif_top#ROW @@ -198,12 +357,50 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; rdfs:subClassOf :DATA_ITEMS , [ rdf:type owl:Restriction ; owl:onProperty :hasSpatialDirectPart ; - owl:someValuesFrom :_type + owl:someValuesFrom :DATA_VALUE ] ; rdfs:comment "Represents a single row in a table with data items as direct parts."@en ; skos:prefLabel "ROW"@en . +### http://emmo.info/domain-crystallography/cif_top#Range +:Range rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialDirectPart ; + owl:qualifiedCardinality "2"^^xsd:nonNegativeInteger ; + owl:onClass :Real + ] ; + rdfs:comment "Inclusive range of numerical values min:max."@en ; + skos:prefLabel "Range"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Real +:Real rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasFloatData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:double + ] ; + rdfs:comment "Floating-point real number."@en ; + skos:prefLabel "Real"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Single +:Single rdf:type owl:Class ; + rdfs:subClassOf :DATA_VALUE ; + rdfs:comment "Single value."@en ; + skos:prefLabel "Single"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Symop +:Symop rdf:type owl:Class ; + rdfs:subClassOf :Text ; + rdfs:comment "A string composed of an integer optionally followed by an underscore or space and three or more digits."@en ; + skos:prefLabel "Symop"@en . + + ### http://emmo.info/domain-crystallography/cif_top#TABLE :TABLE rdf:type owl:Class ; rdfs:subClassOf :DDL_CONCEPT , @@ -232,38 +429,67 @@ but the actual TABLE individual is just the data rows: skos:prefLabel "TABLE"@en . -### http://emmo.info/domain-crystallography/cif_top#_char -:_char rdf:type owl:Class ; - rdfs:subClassOf :_type ; - rdfs:comment "A symbolic data type whos individuals are strings."@en ; - skos:prefLabel "char"@en . +### http://emmo.info/domain-crystallography/cif_top#Table +:Table rdf:type owl:Class ; + rdfs:subClassOf :DATA_VALUE , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSpatialPart ; + owl:someValuesFrom :Single + ] ; + rdfs:comment "An unordered set of id:value elements."@en ; + skos:prefLabel "Table"@en . -### http://emmo.info/domain-crystallography/cif_top#_null -:_null rdf:type owl:Class ; - rdfs:subClassOf :_type ; - skos:prefLabel "null"@en . +### http://emmo.info/domain-crystallography/cif_top#Tag +:Tag rdf:type owl:Class ; + rdfs:subClassOf :Code ; + rdfs:comment "Case-insensitive CIF2 character sequence with leading underscore and no ASCII whitespace."@en ; + skos:prefLabel "Tag"@en . -### http://emmo.info/domain-crystallography/cif_top#_numb -:_numb rdf:type owl:Class ; - rdfs:subClassOf :_type ; - rdfs:comment "A floating point data type with an optional associated uncertainty."@en ; - skos:prefLabel "numb"@en . +### http://emmo.info/domain-crystallography/cif_top#Text +:Text rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSymbolData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:string + ] ; + rdfs:comment "Case-sensitive sequence of CIF2 characters."@en ; + skos:prefLabel "Text"@en . -### http://emmo.info/domain-crystallography/cif_top#_type -:_type rdf:type owl:Class ; - rdfs:subClassOf :DDL_CONCEPT ; - rdfs:comment "Data items correspond to a type. Its individuals are the actual data strings or numbers."@en ; - skos:prefLabel "DATA_ITEM"@en . +### http://emmo.info/domain-crystallography/cif_top#Uri +:Uri rdf:type owl:Class ; + rdfs:subClassOf :Single , + [ rdf:type owl:Restriction ; + owl:onProperty :hasUriData ; + owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ; + owl:onDataRange xsd:anyURI + ] ; + rdfs:comment "Uniform Resource Identifier reference as defined in RFC 3986 Section 4.1."@en ; + skos:prefLabel "Uri"@en . + + +### http://emmo.info/domain-crystallography/cif_top#Version +:Version rdf:type owl:Class ; + rdfs:subClassOf :Text ; + rdfs:comment "Version digit string of the form \"..\"."@en ; + skos:prefLabel "Version"@en . -### http://emmo.info/domain-crystallography/cif_top#enumeration -:enumeration rdf:type owl:Class ; - rdfs:subClassOf :_char ; - rdfs:comment "A subclass of `char` whos individuals is one of a limited set of pre-defined strings."@en ; - skos:prefLabel "enumeration"@en . +################################################################# +# General axioms +################################################################# + +[ rdf:type owl:AllDisjointClasses ; + owl:members ( :Array + :List + :Matrix + :Single + :Table + ) +] . ### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi diff --git a/generate_cif.py b/generate_cif.py index 5711b78..b8d0e57 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -10,7 +10,7 @@ import owlready2 from owlready2 import locstr -from CifFile import ReadCif +from CifFile import CifDic def en(s): @@ -30,7 +30,7 @@ class Generator: URI or file name of the cif_top ontology that will be imported. """ def __init__(self, dicfile, base_iri, cif_top='cif_top.ttl'): - self.cf = ReadCif(dicfile) + self.cd = CifDic(dicfile, do_dREL=False) self.cif_top = cif_top self.categories = set() @@ -43,28 +43,21 @@ def __init__(self, dicfile, base_iri, cif_top='cif_top.ttl'): self.onto = self.world.get_ontology(base_iri) self.onto.imported_ontologies.append(self.top) - def generate(self, dics=None): - """Generate ontology for the given sequence of CIF dictionary names. - By default the dictionaries are inferred from the `dicfile`.""" - if dics is None: - dics = self.cf.keys() - for dicname in dics: - self._generate_dic(dicname) - return self.onto - - def _generate_dic(self, dicname): - """Generate ontology for dictionary `name`.""" + def generate(self): + """Generate ontology for the CIF dictionary.""" # Add categories first so they are available when we add data items. # A category seems to be characterised by having a _definition.scope # attribute. - for item in self.cf.get_children(dicname): + for item in self.cd: if '_definition.scope' in item: self._add_category(item) # Add data items - for item in self.cf.get_children(dicname): + for item in self.cd: if '_definition.scope' not in item: - self._add_data_item(item) + self._add_data_value(item) + + return self.onto def _add_category(self, item): """Add category.""" @@ -76,7 +69,7 @@ def _add_category(self, item): descr = item.get('_description.text') lname = '_' + name.lstrip('_').lower() with self.onto: - if item.get('_definition.class') in ('Loop', 'Set'): + if item.get('_definition.class'): table = types.new_class(lname + '_TABLE', (self.top.TABLE, )) table.prefLabel.append(en(table.name.lstrip('_'))) row = types.new_class(lname + '_ROW', (self.top.ROW, )) @@ -90,50 +83,71 @@ def _add_category(self, item): else: print('** ignoring category:', name) - def _add_data_item(self, item): + def _add_data_value(self, item): """Add data item.""" name = item['_definition.id'] descr = item.get('_description.text') units = item.get('_units.code') aliases = item.get('_alias.definition_id') + examples = item.get('_description_example.detail', []) + examples.extend(item.get('_description_example.case', [])) + dimension = item.get('_type.dimension') + + container_name = item.get('_type.container', 'Single') + type_name = item.get('_type.contents', 'Text') category_name = item['_name.category_id'].upper() row_name = '_%s_ROW' % item['_name.category_id'] - if category_name in self.onto: - category = self.onto[category_name] - with self.onto: - # FIXME - inherit from type instead of category - e = types.new_class(name, (category, )) - if category.disjoint_unions: - category.disjoint_unions[0].append(e) - else: - category.disjoint_unions.append([e]) - e.prefLabel.append(en(name.lstrip('_'))) - - # Hmm, _name is already used internally by owlready2.Ontology - # so `e._name.append(name)` won't work. - # We have to add the tripple the hard way... - o, d = owlready2.to_literal(name) # not localised - self.onto._set_data_triple_spod( - s=e.storid, - p=self.onto.world._props['_name'].storid, - o=o, d=d) - - if aliases: - e.altLabel.extend(en(a) for a in aliases) - if descr: - e.comment.append(en(textwrap.dedent(descr))) - if units: - e._unit.append(units) # not localised - if row_name in self.onto: - row = self.onto[row_name] - row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) + + container = self.onto[container_name] + _type = self.onto[type_name] + category = self.onto[category_name] + + with self.onto: + + if container_name == 'Single': + e = types.new_class(name, (_type, )) + else: + e = types.new_class(name, (container, )) + if container_name == 'List': + e.is_a.append(self.top.hasSpatialDirectPart.some(_type)) else: - print('** no row:', name) - else: - print('** no category:', name) + e.is_a.append(self.top.hasSpatialPart.some(_type)) + + if category.disjoint_unions: + category.disjoint_unions[0].append(e) + else: + category.disjoint_unions.append([e]) + e.prefLabel.append(en(name.lstrip('_'))) + + # Hmm, _name is already used internally by owlready2.Ontology + # so `e._name.append(name)` won't work. + # We have to add the tripple the hard way... + o, d = owlready2.to_literal(name) # not localised + self.onto._set_data_triple_spod( + s=e.storid, + p=self.onto.world._props['_name'].storid, + o=o, d=d) + + if aliases: + e.altLabel.extend(en(a) for a in aliases) + if descr: + e.comment.append(en(textwrap.dedent(descr))) + if examples: + e.example.extend(en(textwrap.dedent(ex)) for ex in examples) + if units: + e._unit.append(units) # not localised + if dimension: + e._dimension.append(dimension) # not localised + if row_name in self.onto: + row = self.onto[row_name] + row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) + else: + print('** no row:', name) def main(): + base_iri = 'http://emmo.info/domain-crystallography/cif_core#' + # Download the CIF dictionaries to current directory baseurl = 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/' for dic in 'ddl.dic', 'cif_core.dic', 'templ_attr.cif', 'templ_enum.cif': @@ -141,8 +155,7 @@ def main(): print('downloading', dic) urllib.request.urlretrieve(baseurl + dic, dic) - gen = Generator(dicfile='cif_core.dic', - base_iri='http://emmo.info/domain-crystallography/cif_core#') + gen = Generator(dicfile='cif_core.dic', base_iri=base_iri) onto = gen.generate() # Annotate ontology @@ -165,6 +178,6 @@ def main(): self = gen = main() top = self.top onto = self.onto - items = self.cf.get_children('core_dic') - sid = items['space_group_symop.id'] - s = items['SPACE_GROUP_SYMOP'] + cd = self.cd + sid = cd['space_group_symop.id'] + s = cd['SPACE_GROUP_SYMOP'] From 668b42f4484c921095205b9fbcd292801a4046b3 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 8 Apr 2021 23:07:52 +0200 Subject: [PATCH 15/17] Generated specific matrix and array types. --- cif_top.ttl | 11 ++++++++++- generate_cif.py | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/cif_top.ttl b/cif_top.ttl index 24525a7..96c9087 100644 --- a/cif_top.ttl +++ b/cif_top.ttl @@ -27,7 +27,9 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail ### http://emmo.info/domain-crystallography/cif_top#_dimension :_dimension rdf:type owl:AnnotationProperty ; - rdfs:comment "Size of an Array/Matrix/List expressed as a text string. The text string itself consists of zero or more non-negative integers separated by commas placed within bounding square brackets. Empty square brackets represent a list of unknown size."@en ; + :example "[3,4]"@en ; + rdfs:comment "Correspond to the '_type.dimension' data item."@en , + "Size of an Array/Matrix/List expressed as a text string. The text string itself consists of zero or more non-negative integers separated by commas placed within bounding square brackets. Empty square brackets represent a list of unknown size."@en ; skos:prefLabel "_dimension"@en . @@ -39,6 +41,13 @@ It tries to ahead to the CIF methods dictionary definition language (DDLm) avail rdfs:domain . +### http://emmo.info/domain-crystallography/cif_top#_type +:_type rdf:type owl:AnnotationProperty ; + rdfs:comment "Correspond to the '_type.contents' data item."@en , + "Type of CIF data value."@en ; + skos:prefLabel "_datatype"@en . + + ### http://emmo.info/domain-crystallography/cif_top#_unit :_unit rdf:type owl:AnnotationProperty ; rdfs:comment "Unit accociated to a data item."@en ; diff --git a/generate_cif.py b/generate_cif.py index b8d0e57..5b9de13 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -85,7 +85,8 @@ def _add_category(self, item): def _add_data_value(self, item): """Add data item.""" - name = item['_definition.id'] + realname = item['_definition.id'] + name = realname.replace('.', '_') descr = item.get('_description.text') units = item.get('_units.code') aliases = item.get('_alias.definition_id') @@ -106,6 +107,14 @@ def _add_data_value(self, item): if container_name == 'Single': e = types.new_class(name, (_type, )) + elif container_name in ('Matrix', 'Array'): + dims = dimension.strip('[]') + if dims: + subarr = self.subarray(dims.split(','), _type, + container_name) + e = types.new_class(name, (subarr, )) + else: + e = types.new_class(name, (_type, )) else: e = types.new_class(name, (container, )) if container_name == 'List': @@ -117,12 +126,14 @@ def _add_data_value(self, item): category.disjoint_unions[0].append(e) else: category.disjoint_unions.append([e]) - e.prefLabel.append(en(name.lstrip('_'))) + e.prefLabel.append(en(realname.lstrip('_'))) + if name != realname: + e.altLabel.append(en(name.lstrip('_'))) # Hmm, _name is already used internally by owlready2.Ontology # so `e._name.append(name)` won't work. # We have to add the tripple the hard way... - o, d = owlready2.to_literal(name) # not localised + o, d = owlready2.to_literal(realname) # not localised self.onto._set_data_triple_spod( s=e.storid, p=self.onto.world._props['_name'].storid, @@ -138,12 +149,32 @@ def _add_data_value(self, item): e._unit.append(units) # not localised if dimension: e._dimension.append(dimension) # not localised + if _type: + e._type.append(_type) # not localised if row_name in self.onto: row = self.onto[row_name] row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) else: print('** no row:', name) + def subarray(self, dimensions, _type, container_name): + """Returns a reference to an array or matrix corresponding to: + - dimensions: list of dimension values + - typename: type of elements + - container_name: "Array" or "Matrix" + If it does not already exists, the subarray is created. All + its spatial direct parts are also generated recursively. + """ + if not dimensions or not dimensions[0]: + return _type + name = 'Shape' + 'x'.join(dimensions) + _type.name + container_name + if name not in self.onto: + e = types.new_class(name, (self.onto[container_name], )) + d = int(dimensions.pop(0)) + e.is_a.append(self.top.hasSpatialDirectPart.exactly( + d, self.subarray(dimensions, _type, container_name))) + return self.onto[name] + def main(): base_iri = 'http://emmo.info/domain-crystallography/cif_core#' From 223fae76f5e44c46ec2c6501ff75278c1b521d24 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 8 Apr 2021 23:29:18 +0200 Subject: [PATCH 16/17] Renamed _type as datatype --- generate_cif.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/generate_cif.py b/generate_cif.py index 5b9de13..9c19a92 100755 --- a/generate_cif.py +++ b/generate_cif.py @@ -95,32 +95,32 @@ def _add_data_value(self, item): dimension = item.get('_type.dimension') container_name = item.get('_type.container', 'Single') - type_name = item.get('_type.contents', 'Text') + datatype_name = item.get('_type.contents', 'Text') category_name = item['_name.category_id'].upper() row_name = '_%s_ROW' % item['_name.category_id'] container = self.onto[container_name] - _type = self.onto[type_name] + datatype = self.onto[datatype_name] category = self.onto[category_name] with self.onto: if container_name == 'Single': - e = types.new_class(name, (_type, )) + e = types.new_class(name, (datatype, )) elif container_name in ('Matrix', 'Array'): dims = dimension.strip('[]') if dims: - subarr = self.subarray(dims.split(','), _type, + subarr = self.subarray(dims.split(','), datatype, container_name) e = types.new_class(name, (subarr, )) else: - e = types.new_class(name, (_type, )) + e = types.new_class(name, (datatype, )) else: e = types.new_class(name, (container, )) if container_name == 'List': - e.is_a.append(self.top.hasSpatialDirectPart.some(_type)) + e.is_a.append(self.top.hasSpatialDirectPart.some(datatype)) else: - e.is_a.append(self.top.hasSpatialPart.some(_type)) + e.is_a.append(self.top.hasSpatialPart.some(datatype)) if category.disjoint_unions: category.disjoint_unions[0].append(e) @@ -149,15 +149,15 @@ def _add_data_value(self, item): e._unit.append(units) # not localised if dimension: e._dimension.append(dimension) # not localised - if _type: - e._type.append(_type) # not localised + if datatype: + e._datatype.append(datatype) # not localised if row_name in self.onto: row = self.onto[row_name] row.is_a.append(self.top.hasSpatialDirectPart.max(1, e)) else: - print('** no row:', name) + print('** no row:', realname) - def subarray(self, dimensions, _type, container_name): + def subarray(self, dimensions, datatype, container_name): """Returns a reference to an array or matrix corresponding to: - dimensions: list of dimension values - typename: type of elements @@ -166,13 +166,13 @@ def subarray(self, dimensions, _type, container_name): its spatial direct parts are also generated recursively. """ if not dimensions or not dimensions[0]: - return _type - name = 'Shape' + 'x'.join(dimensions) + _type.name + container_name + return datatype + name = 'Shape' + 'x'.join(dimensions) + datatype.name + container_name if name not in self.onto: e = types.new_class(name, (self.onto[container_name], )) d = int(dimensions.pop(0)) e.is_a.append(self.top.hasSpatialDirectPart.exactly( - d, self.subarray(dimensions, _type, container_name))) + d, self.subarray(dimensions, datatype, container_name))) return self.onto[name] From abd217f2cd21d5e2a46e1991449b909f958c8b2f Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Thu, 8 Apr 2021 23:32:25 +0200 Subject: [PATCH 17/17] Corrected prefLabel --- cif_top.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cif_top.ttl b/cif_top.ttl index 96c9087..d02e9b1 100644 --- a/cif_top.ttl +++ b/cif_top.ttl @@ -119,7 +119,7 @@ skos:prefLabel rdf:type owl:AnnotationProperty ; ### http://emmo.info/domain-crystallography/cif_top#hasDateTimeData :hasDateTimeData rdf:type owl:DatatypeProperty ; rdfs:range xsd:dateTime ; - rdfs:comment "hasDateTimeData"@en . + skos:prefLabel "hasDateTimeData"@en . ### http://emmo.info/domain-crystallography/cif_top#hasFloatData