diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/EtymonLanguage.xml b/dmlex-v1.0/specification/serializations/RDF/elements/EtymonLanguage.xml index 769baa6..32e0fd5 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/EtymonLanguage.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/EtymonLanguage.xml @@ -14,7 +14,7 @@ Properties - dmlex:langCode REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language + dmlex:langCode REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) dmlex:displayName OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#string diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/EtymonUnit.xml b/dmlex-v1.0/specification/serializations/RDF/elements/EtymonUnit.xml index 5261dbe..018002d 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/EtymonUnit.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/EtymonUnit.xml @@ -17,7 +17,7 @@ dmlex:listingOrder REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#nonNegativeInteger - dmlex:language REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) + dmlex:langCode OPTIONAL of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) dmlex:partOfSpeech OPTIONAL reference to PartOfSpeech diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/ExampleTranslation.xml b/dmlex-v1.0/specification/serializations/RDF/elements/ExampleTranslation.xml index 424fc32..1c32b4a 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/ExampleTranslation.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/ExampleTranslation.xml @@ -17,7 +17,7 @@ dmlex:listingOrder OPTIONAL of type http://www.w3.org/2001/XMLSchema#nonNegativeInteger - dmlex:language OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) + dmlex:langCode OPTIONAL of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) dmlex:label OPTIONAL reference to Label diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordExplanation.xml b/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordExplanation.xml index 5c6bf90..e7070ad 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordExplanation.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordExplanation.xml @@ -14,7 +14,7 @@ Properties - dmlex:language OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) + dmlex:langCode OPTIONAL of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) dmlex:text REQUIRED (exactly 1) of type http://www.w3.org/2000/01/rdf-schema#Literal diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordTranslation.xml b/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordTranslation.xml index 9e7dd57..08c99b7 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordTranslation.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/HeadwordTranslation.xml @@ -17,7 +17,7 @@ dmlex:listingOrder REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#nonNegativeInteger - dmlex:language OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) + dmlex:langCode OPTIONAL of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) dmlex:partOfSpeech OPTIONAL reference to PartOfSpeech diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/LexicographicResource.xml b/dmlex-v1.0/specification/serializations/RDF/elements/LexicographicResource.xml index 5c1a2be..d3df979 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/LexicographicResource.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/LexicographicResource.xml @@ -62,7 +62,7 @@ dmlex:etymonLanguage OPTIONAL reference to EtymonLanguage - dmlex:language REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) + dmlex:langCode REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/Member.xml b/dmlex-v1.0/specification/serializations/RDF/elements/Member.xml index 00e61a6..7d13458 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/Member.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/Member.xml @@ -17,12 +17,10 @@ dmlex:listingOrder REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#nonNegativeInteger - dmlex:ref REQUIRED (exactly 1) of type - http://www.w3.org/2001/XMLSchema#string + dmlex:ref REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#string - dmlex:obverseListingOrder OPTIONAL (at most 1) of type - http://www.w3.org/2001/XMLSchema#integer + dmlex:obverseListingOrder OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#integer dmlex:role OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#string diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/MemberType.xml b/dmlex-v1.0/specification/serializations/RDF/elements/MemberType.xml index 4461c6b..e6f704c 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/MemberType.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/MemberType.xml @@ -17,7 +17,7 @@ dmlex:description OPTIONAL (at most 1) of type http://www.w3.org/2000/01/rdf-schema#Literal - dmlex:type OPTIONAL of type http://www.w3.org/2001/XMLSchema#string + dmlex:type REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#string dmlex:role OPTIONAL (at most 1) of type http://www.w3.org/2001/XMLSchema#string diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/Sense.xml b/dmlex-v1.0/specification/serializations/RDF/elements/Sense.xml index 0543738..42d8a35 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/Sense.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/Sense.xml @@ -26,7 +26,7 @@ dmlex:label OPTIONAL reference to Label - dmlex:indicator OPTIONAL (at most 1) reference to Indicator + dmlex:indicator OPTIONAL (at most 1) of type http://www.w3.org/2000/01/rdf-schema#Literal dmlex:definition OPTIONAL reference to Definition diff --git a/dmlex-v1.0/specification/serializations/RDF/elements/TranslationLanguage.xml b/dmlex-v1.0/specification/serializations/RDF/elements/TranslationLanguage.xml index a59c518..98c1639 100644 --- a/dmlex-v1.0/specification/serializations/RDF/elements/TranslationLanguage.xml +++ b/dmlex-v1.0/specification/serializations/RDF/elements/TranslationLanguage.xml @@ -17,7 +17,7 @@ dmlex:listingOrder REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#nonNegativeInteger - dmlex:langCode REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language + dmlex:langCode REQUIRED (exactly 1) of type http://www.w3.org/2001/XMLSchema#language (subproperty of http://www.w3.org/ns/lemon/lime#language) diff --git a/dmlex-v1.0/specification/serializations/RDF/gen_shacl_from_rdf.py b/dmlex-v1.0/specification/serializations/RDF/gen_shacl_from_rdf.py new file mode 100644 index 0000000..efe6112 --- /dev/null +++ b/dmlex-v1.0/specification/serializations/RDF/gen_shacl_from_rdf.py @@ -0,0 +1,87 @@ +import rdflib +from collections import defaultdict +from rdflib.namespace import RDF, RDFS, OWL, URIRef +from rdflib.collection import Collection + +DMLEX = "http://www.oasis-open.org/to-be-confirmed/dmlex#" +DMLEX_SHACL = "http://www.oasis-open.org/to-be-confirmed/dmlex-shacl#" + +def parse_rdf(): + g = rdflib.Graph() + g.parse("ontology/dmlex.ttl", format="turtle") + + props = defaultdict(list) + for s, p, o in g.triples((None, RDFS.domain, None)): + if isinstance(o, rdflib.term.URIRef): + if str(o).startswith(DMLEX + "Has"): + for domain_class in g.subjects(RDFS.subClassOf, o): + props[domain_class].append(s) + else: + props[o].append(s) + else: + for listname in g.objects(o, OWL.unionOf): + for item in Collection(g, listname): + props[item].append(s) + + ranges = defaultdict(list) + for s, p, o in g.triples((None, RDFS.range, None)): + if isinstance(o, rdflib.term.URIRef): + ranges[s].append(o) + + with open("ontology/dmlex.shacl", "w") as file: + file.write("# This file was generated from dmlex.ttl by " + + "gen_shacl_from_rdf.py\n") + file.write("@prefix sh: .\n") + file.write(f"@prefix dmlex: <{DMLEX}> .\n") + file.write(f"@prefix : <{DMLEX_SHACL}> .\n\n") + for class_uri in g.subjects(RDF.type, OWL.Class): + if (isinstance(class_uri, rdflib.term.URIRef) and + not str(class_uri).startswith(DMLEX + "Has")): + uri = str(class_uri) + name = uri.split("#")[-1] + + subclasses = [] + restrictions = defaultdict(lambda: defaultdict(lambda: [0,-1])) + for o in g.objects(class_uri, RDFS.subClassOf): + if (isinstance(o, rdflib.term.URIRef) and + not str(o).startswith(DMLEX + "Has")): + subclasses.append(str(o)) + elif isinstance(o, rdflib.term.BNode): + for o2 in g.objects(o, OWL.onProperty): + for o3 in g.objects(o, OWL.cardinality): + restrictions[class_uri][o2] = [o3, o3] + for o3 in g.objects(o, OWL.maxCardinality): + restrictions[class_uri][o2] = [0, o3] + for o3 in g.objects(o, OWL.minCardinality): + restrictions[class_uri][o2] = [o3, -1] + file.write(f""" +:{name}Shape ; + a sh:NodeShape ; + sh:targetClass dmlex:{name} ; + sh:closed false""") + for prop in props[class_uri]: + file.write(f""" ; + sh:property [ + sh:path dmlex:{prop.split("#")[-1]} """) + if prop in restrictions[class_uri]: + min_card, max_card = restrictions[class_uri][prop] + if min_card >= 0: + file.write(f""" ; + sh:minCount {min_card}""") + if max_card >= 0: + file.write(f""" ; + sh:maxCount {max_card}""") + for range in ranges[prop]: + if range.startswith(DMLEX): + file.write(f""" ; + sh:class dmlex:{range.split("#")[-1]} """) + file.write(" ]") + + file.write(" .\n\n") + + + + + +if __name__ == "__main__": + parse_rdf() diff --git a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-core.ttl b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-core.ttl index 3760674..2799ba4 100644 --- a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-core.ttl +++ b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-core.ttl @@ -39,7 +39,7 @@ dmlex:LexicographicResource a owl:Class ; rdfs:label "Lexicographic resource"@en ; rdfs:subClassOf [ a owl:Restriction ; - owl:onProperty dmlex:language ; + owl:onProperty dmlex:langCode ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:title ; @@ -59,17 +59,17 @@ dmlex:uri a owl:DatatypeProperty ; rdfs:domain dmlex:LexicographicResource ; rdfs:range xsd:anyURI . -dmlex:language a owl:DatatypeProperty ; +dmlex:langCode a owl:DatatypeProperty ; rdfs:label "Language"@en ; - rdfs:domain dmlex:HasLanguage ; + rdfs:domain dmlex:HasLangCode ; rdfs:range xsd:language ; rdfs:subPropertyOf lime:language . -dmlex:LexicographicResource rdfs:subClassOf dmlex:HasLanguage . -dmlex:HeadwordTranslation rdfs:subClassOf dmlex:HasLanguage . -dmlex:HeadwordExplanation rdfs:subClassOf dmlex:HasLanguage . -dmlex:ExampleTranslation rdfs:subClassOf dmlex:HasLanguage . -dmlex:EtymonUnit rdfs:subClassOf dmlex:HasLanguage . +dmlex:LexicographicResource rdfs:subClassOf dmlex:HasLangCode . +dmlex:HeadwordTranslation rdfs:subClassOf dmlex:HasLangCode . +dmlex:HeadwordExplanation rdfs:subClassOf dmlex:HasLangCode . +dmlex:ExampleTranslation rdfs:subClassOf dmlex:HasLangCode . +dmlex:EtymonUnit rdfs:subClassOf dmlex:HasLangCode . dmlex:entry a owl:ObjectProperty ; rdfs:label "Entry"@en ; @@ -217,7 +217,7 @@ dmlex:Sense a owl:Class ; dmlex:indicator a owl:ObjectProperty ; rdfs:label "Indicator"@en ; rdfs:domain dmlex:Sense ; - rdfs:range dmlex:Indicator . + rdfs:range rdfs:Literal . dmlex:definition a owl:ObjectProperty ; rdfs:label "Definition"@en ; diff --git a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-linking.ttl b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-linking.ttl index 17d2ba7..f47660d 100644 --- a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-linking.ttl +++ b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex-linking.ttl @@ -57,7 +57,7 @@ dmlex:Member a owl:Class ; rdfs:label "Member"@en ; rdfs:subClassOf [ a owl:Restriction ; - owl:onProperty dmlex:memberID ; + owl:onProperty dmlex:ref ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:role ; @@ -67,10 +67,10 @@ dmlex:Member a owl:Class ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:obverseListingOrder ; - owl:cardinality 1 ] . + owl:maxCardinality 1 ] . -dmlex:memberID a owl:DatatypeProperty ; - rdfs:label "Member ID"@en ; +dmlex:ref a owl:DatatypeProperty ; + rdfs:label "Ref"@en ; rdfs:domain dmlex:Member ; rdfs:range xsd:string . diff --git a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.shacl b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.shacl new file mode 100644 index 0000000..2159169 --- /dev/null +++ b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.shacl @@ -0,0 +1,714 @@ +# This file was generated from dmlex.ttl by gen_shacl_from_rdf.py +@prefix sh: . +@prefix dmlex: . +@prefix : . + + +:LexicographicResourceShape ; + a sh:NodeShape ; + sh:targetClass dmlex:LexicographicResource ; + sh:closed false ; + sh:property [ + sh:path dmlex:title ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:uri ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:entry ; + sh:class dmlex:Entry ] ; + sh:property [ + sh:path dmlex:translationLanguage ; + sh:class dmlex:TranslationLanguage ] ; + sh:property [ + sh:path dmlex:definitionTypeTag ; + sh:class dmlex:DefinitionTypeTag ] ; + sh:property [ + sh:path dmlex:inflectedFormTag ; + sh:class dmlex:InflectedFormTag ] ; + sh:property [ + sh:path dmlex:labelTypeTag ; + sh:class dmlex:LabelTypeTag ] ; + sh:property [ + sh:path dmlex:partOfSpeechTag ; + sh:class dmlex:PartOfSpeechTag ] ; + sh:property [ + sh:path dmlex:sourceIdentityTag ; + sh:class dmlex:SourceIdentityTag ] ; + sh:property [ + sh:path dmlex:transcriptionSchemeTag ; + sh:class dmlex:TranscriptionSchemeTag ] ; + sh:property [ + sh:path dmlex:relation ; + sh:class dmlex:Relation ] ; + sh:property [ + sh:path dmlex:relationType ; + sh:class dmlex:RelationType ] ; + sh:property [ + sh:path dmlex:etymonType ; + sh:class dmlex:EtymonType ] ; + sh:property [ + sh:path dmlex:etymonLanguage ; + sh:class dmlex:EtymonLanguage ] ; + sh:property [ + sh:path dmlex:langCode ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:EntryShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Entry ; + sh:closed false ; + sh:property [ + sh:path dmlex:headword ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:homographNumber ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:sense ; + sh:class dmlex:Sense ] ; + sh:property [ + sh:path dmlex:etymology ; + sh:class dmlex:Etymology ] ; + sh:property [ + sh:path dmlex:partOfSpeech ; + sh:class dmlex:PartOfSpeech ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:pronunciation ; + sh:class dmlex:Pronunciation ] ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:placeholderMarker ; + sh:class dmlex:PlaceholderMarker ] . + + +:PartOfSpeechShape ; + a sh:NodeShape ; + sh:targetClass dmlex:PartOfSpeech ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:InflectedFormShape ; + a sh:NodeShape ; + sh:targetClass dmlex:InflectedForm ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:pronunciation ; + sh:class dmlex:Pronunciation ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:SenseShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Sense ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:indicator ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:definition ; + sh:class dmlex:Definition ] ; + sh:property [ + sh:path dmlex:example ; + sh:class dmlex:Example ] ; + sh:property [ + sh:path dmlex:headwordExplanation ; + sh:class dmlex:HeadwordExplanation ] ; + sh:property [ + sh:path dmlex:headwordTranslation ; + sh:class dmlex:HeadwordTranslation ] . + + +:DefinitionShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Definition ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:definitionType ; + sh:minCount 0 ; + sh:maxCount 1 ; + sh:class dmlex:DefinitionType ] ; + sh:property [ + sh:path dmlex:headwordMarker ; + sh:class dmlex:HeadwordMarker ] ; + sh:property [ + sh:path dmlex:collocateMarker ; + sh:class dmlex:CollocateMarker ] . + + +:LabelShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Label ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:PronunciationShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Pronunciation ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:soundFile ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:transcription ; + sh:class dmlex:Transcription ] . + + +:TranscriptionShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Transcription ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:scheme ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:ExampleShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Example ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:soundFile ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:sourceIdentity ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:sourceElaboration ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:exampleTranslation ; + sh:class dmlex:ExampleTranslation ] ; + sh:property [ + sh:path dmlex:headwordMarker ; + sh:class dmlex:HeadwordMarker ] ; + sh:property [ + sh:path dmlex:collocateMarker ; + sh:class dmlex:CollocateMarker ] . + + +:TranslationLanguageShape ; + a sh:NodeShape ; + sh:targetClass dmlex:TranslationLanguage ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:langCode ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:HeadwordTranslationShape ; + a sh:NodeShape ; + sh:targetClass dmlex:HeadwordTranslation ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:langCode ] ; + sh:property [ + sh:path dmlex:partOfSpeech ; + sh:class dmlex:PartOfSpeech ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:pronunciation ; + sh:class dmlex:Pronunciation ] ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:placeholderMarker ; + sh:class dmlex:PlaceholderMarker ] . + + +:HeadwordExplanationShape ; + a sh:NodeShape ; + sh:targetClass dmlex:HeadwordExplanation ; + sh:closed false ; + sh:property [ + sh:path dmlex:langCode ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:ExampleTranslationShape ; + a sh:NodeShape ; + sh:targetClass dmlex:ExampleTranslation ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ] ; + sh:property [ + sh:path dmlex:langCode ] ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:soundFile ] ; + sh:property [ + sh:path dmlex:headwordMarker ; + sh:class dmlex:HeadwordMarker ] ; + sh:property [ + sh:path dmlex:collocateMarker ; + sh:class dmlex:CollocateMarker ] . + + +:DefinitionTypeTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:DefinitionTypeTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:InflectedFormTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:InflectedFormTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:forPartOfSpeech ] . + + +:LabelTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:LabelTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:forPartOfSpeech ] ; + sh:property [ + sh:path dmlex:forCollocates ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:LabelTypeTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:LabelTypeTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:PartOfSpeechTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:PartOfSpeechTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:forEtymology ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:SourceIdentityTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:SourceIdentityTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:TranscriptionSchemeTagShape ; + a sh:NodeShape ; + sh:targetClass dmlex:TranscriptionSchemeTag ; + sh:closed false ; + sh:property [ + sh:path dmlex:inflectedForm ; + sh:class dmlex:InflectedForm ] ; + sh:property [ + sh:path dmlex:tag ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:RelationShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Relation ; + sh:closed false ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:type ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:member ; + sh:minCount 2 ; + sh:class dmlex:Member ] . + + +:MemberShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Member ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:ref ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:obverseListingOrder ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:role ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:RelationTypeShape ; + a sh:NodeShape ; + sh:targetClass dmlex:RelationType ; + sh:closed false ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:type ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:scope ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:memberType ; + sh:class dmlex:MemberType ] . + + +:MemberTypeShape ; + a sh:NodeShape ; + sh:targetClass dmlex:MemberType ; + sh:closed false ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:type ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:role ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:min ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:max ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:action ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:PlaceholderMarkerShape ; + a sh:NodeShape ; + sh:targetClass dmlex:PlaceholderMarker ; + sh:closed false ; + sh:property [ + sh:path dmlex:startIndex ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:endIndex ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:HeadwordMarkerShape ; + a sh:NodeShape ; + sh:targetClass dmlex:HeadwordMarker ; + sh:closed false ; + sh:property [ + sh:path dmlex:startIndex ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:endIndex ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:CollocateMarkerShape ; + a sh:NodeShape ; + sh:targetClass dmlex:CollocateMarker ; + sh:closed false ; + sh:property [ + sh:path dmlex:label ; + sh:class dmlex:Label ] ; + sh:property [ + sh:path dmlex:lemma ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:EtymologyShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Etymology ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:etymon ; + sh:class dmlex:Etymon ] . + + +:EtymonShape ; + a sh:NodeShape ; + sh:targetClass dmlex:Etymon ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:type ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:when ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:note ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:etymonUnit ; + sh:minCount 1 ; + sh:class dmlex:EtymonUnit ] ; + sh:property [ + sh:path dmlex:translation ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:EtymonUnitShape ; + a sh:NodeShape ; + sh:targetClass dmlex:EtymonUnit ; + sh:closed false ; + sh:property [ + sh:path dmlex:listingOrder ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:langCode ] ; + sh:property [ + sh:path dmlex:partOfSpeech ; + sh:class dmlex:PartOfSpeech ] ; + sh:property [ + sh:path dmlex:text ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:translation ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:reconstructed ; + sh:minCount 0 ; + sh:maxCount 1 ] . + + +:EtymonTypeShape ; + a sh:NodeShape ; + sh:targetClass dmlex:EtymonType ; + sh:closed false ; + sh:property [ + sh:path dmlex:description ; + sh:minCount 0 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:type ; + sh:minCount 1 ; + sh:maxCount 1 ] . + + +:EtymonLanguageShape ; + a sh:NodeShape ; + sh:targetClass dmlex:EtymonLanguage ; + sh:closed false ; + sh:property [ + sh:path dmlex:langCode ; + sh:minCount 1 ; + sh:maxCount 1 ] ; + sh:property [ + sh:path dmlex:displayName ; + sh:minCount 0 ; + sh:maxCount 1 ] . + diff --git a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.ttl b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.ttl index 9434b0d..f801dd0 100644 --- a/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.ttl +++ b/dmlex-v1.0/specification/serializations/RDF/ontology/dmlex.ttl @@ -39,7 +39,7 @@ dmlex:LexicographicResource a owl:Class ; rdfs:label "Lexicographic resource"@en ; rdfs:subClassOf [ a owl:Restriction ; - owl:onProperty dmlex:language ; + owl:onProperty dmlex:langCode ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:title ; @@ -59,17 +59,17 @@ dmlex:uri a owl:DatatypeProperty ; rdfs:domain dmlex:LexicographicResource ; rdfs:range xsd:anyURI . -dmlex:language a owl:DatatypeProperty ; +dmlex:langCode a owl:DatatypeProperty ; rdfs:label "Language"@en ; - rdfs:domain dmlex:HasLanguage ; + rdfs:domain dmlex:HasLangCode ; rdfs:range xsd:language ; rdfs:subPropertyOf lime:language . -dmlex:LexicographicResource rdfs:subClassOf dmlex:HasLanguage . -dmlex:HeadwordTranslation rdfs:subClassOf dmlex:HasLanguage . -dmlex:HeadwordExplanation rdfs:subClassOf dmlex:HasLanguage . -dmlex:ExampleTranslation rdfs:subClassOf dmlex:HasLanguage . -dmlex:EtymonUnit rdfs:subClassOf dmlex:HasLanguage . +dmlex:LexicographicResource rdfs:subClassOf dmlex:HasLangCode . +dmlex:HeadwordTranslation rdfs:subClassOf dmlex:HasLangCode . +dmlex:HeadwordExplanation rdfs:subClassOf dmlex:HasLangCode . +dmlex:ExampleTranslation rdfs:subClassOf dmlex:HasLangCode . +dmlex:EtymonUnit rdfs:subClassOf dmlex:HasLangCode . dmlex:entry a owl:ObjectProperty ; rdfs:label "Entry"@en ; @@ -217,7 +217,7 @@ dmlex:Sense a owl:Class ; dmlex:indicator a owl:ObjectProperty ; rdfs:label "Indicator"@en ; rdfs:domain dmlex:Sense ; - rdfs:range dmlex:Indicator . + rdfs:range rdfs:Literal . dmlex:definition a owl:ObjectProperty ; rdfs:label "Definition"@en ; @@ -670,7 +670,7 @@ dmlex:Member a owl:Class ; rdfs:label "Member"@en ; rdfs:subClassOf [ a owl:Restriction ; - owl:onProperty dmlex:memberID ; + owl:onProperty dmlex:ref ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:role ; @@ -680,10 +680,10 @@ dmlex:Member a owl:Class ; owl:cardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:obverseListingOrder ; - owl:cardinality 1 ] . + owl:maxCardinality 1 ] . -dmlex:memberID a owl:DatatypeProperty ; - rdfs:label "Member ID"@en ; +dmlex:ref a owl:DatatypeProperty ; + rdfs:label "Ref"@en ; rdfs:domain dmlex:Member ; rdfs:range xsd:string . @@ -730,7 +730,7 @@ dmlex:MemberType a owl:Class ; rdfs:subClassOf [ a owl:Restriction ; owl:onProperty dmlex:role ; - owl:cardinality 1 ] , [ + owl:maxCardinality 1 ] , [ a owl:Restriction ; owl:onProperty dmlex:type ; owl:cardinality 1 ] , [ diff --git a/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh b/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh new file mode 100644 index 0000000..ad02975 --- /dev/null +++ b/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh @@ -0,0 +1,7 @@ +# Run in dmlex-v1.0/specification/serializations/RDF/ + +for f in `ls ../../examples/examples/source/*.rdf` +do + echo "Validating $f" + pyshacl -s ontology/dmlex.shacl -df turtle $f -e ontology/dmlex.ttl -i rdfs +done