from rdflib import Namespace, RDF, RDFS, ConjunctiveGraph def statements() : SKOS = Namespace('http://www.w3.org/2008/05/skos#') OWL = Namespace('http://www.w3.org/2002/07/owl#') statements = [] # S1 skos:Concept is an instance of owl:Class. S1 = [] S1.append((SKOS['Concept'], RDF.type, OWL['Class'])) statements.append(S1) # S2 skos:ConceptScheme is an instance of owl:Class. S2 = [] S2.append((SKOS['ConceptScheme'], RDF.type, OWL['Class'])) statements.append(S2) # S3 skos:inScheme and skos:hasTopConcept are each instances of owl:ObjectProperty. S3 = [] S3.append((SKOS['inScheme'], RDF.type, OWL['ObjectProperty'])) S3.append((SKOS['hasTopConcept'], RDF.type, OWL['ObjectProperty'])) statements.append(S3) # S4 The rdfs:range of skos:inScheme is the class skos:ConceptScheme. S4 = [] S4.append((SKOS['inScheme'], RDFS.range, SKOS['ConceptScheme'])) statements.append(S4) # S5 The rdfs:domain of skos:hasTopConcept is the class skos:ConceptScheme. S5 = [] S5.append((SKOS['hasTopConcept'], RDFS.domain, SKOS['ConceptScheme'])) statements.append(S5) # S6 The rdfs:range of skos:hasTopConcept is the class skos:Concept. S6 = [] S6.append((SKOS['hasTopConcept'], RDFS.range, SKOS['Concept'])) statements.append(S6) # S7 skos:ConceptScheme is disjoint with skos:Concept. S7 = [] S7.append((SKOS['ConceptScheme'], OWL['disjointWith'], SKOS['Concept'])) statements.append(S7) # S8 skos:prefLabel, skos:altLabel and skos:hiddenLabel are each instances of owl:DatatypeProperty. S8 = [] S8.append((SKOS['prefLabel'], RDF.type, OWL['DatatypeProperty'])) S8.append((SKOS['altLabel'], RDF.type, OWL['DatatypeProperty'])) S8.append((SKOS['hiddenLabel'], RDF.type, OWL['DatatypeProperty'])) statements.append(S8) # S9 The rdfs:range of each of skos:prefLabel, skos:altLabel and skos:hiddenLabel is the class of RDF plain literals. S9 = [] # no triples to add statements.append(S9) # S10 skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties. S10 = [] # no triples to add statements.append(S10) # S11 A resource has no more than one value of skos:prefLabel per language. S11 = [] # no triples to add statements.append(S11) # S12 skos:notation is an instance of owl:DatatypeProperty. S12 = [] S12.append((SKOS['notation'], RDF.type, OWL['DatatypeProperty'])) statements.append(S12) # S13 skos:note, skos:changeNote, skos:definition, skos:editorialNote, skos:example, skos:historyNote and skos:scopeNote are each instances of owl:ObjectProperty. S13 = [] S13.append((SKOS['note'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['changeNote'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['definition'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['editorialNote'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['example'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['historyNote'], RDF.type, OWL['ObjectProperty'])) S13.append((SKOS['scopeNote'], RDF.type, OWL['ObjectProperty'])) statements.append(S13) # S14 skos:changeNote, skos:definition, skos:editorialNote, skos:example, skos:historyNote and skos:scopeNote are each sub-properties of skos:note. S14 = [] S14.append((SKOS['changeNote'], RDFS.subPropertyOf, SKOS['note'])) S14.append((SKOS['definition'], RDFS.subPropertyOf, SKOS['note'])) S14.append((SKOS['editorialNote'], RDFS.subPropertyOf, SKOS['note'])) S14.append((SKOS['example'], RDFS.subPropertyOf, SKOS['note'])) S14.append((SKOS['historyNote'], RDFS.subPropertyOf, SKOS['note'])) S14.append((SKOS['scopeNote'], RDFS.subPropertyOf, SKOS['note'])) statements.append(S14) # S15 skos:semanticRelation, skos:broader, skos:narrower, skos:related, skos:broaderTransitive and skos:narrowerTransitive are each instances of owl:ObjectProperty. S15 = [] S15.append((SKOS['semanticRelation'], RDF.type, OWL['ObjectProperty'])) S15.append((SKOS['broader'], RDF.type, OWL['ObjectProperty'])) S15.append((SKOS['narrower'], RDF.type, OWL['ObjectProperty'])) S15.append((SKOS['related'], RDF.type, OWL['ObjectProperty'])) S15.append((SKOS['broaderTransitive'], RDF.type, OWL['ObjectProperty'])) S15.append((SKOS['narrowerTransitive'], RDF.type, OWL['ObjectProperty'])) statements.append(S15) # S16 The rdfs:domain of skos:semanticRelation is the class skos:Concept. S16 = [] S16.append((SKOS['semanticRelation'], RDFS.domain, SKOS['Concept'])) statements.append(S16) # S17 The rdfs:range of skos:semanticRelation is the class skos:Concept. S17 = [] S17.append((SKOS['semanticRelation'], RDFS.range, SKOS['Concept'])) statements.append(S17) # S18 skos:broaderTransitive, skos:narrowerTransitive and skos:related are each sub-properties of skos:semanticRelation. S18 = [] S18.append((SKOS['broaderTransitive'], RDFS.subPropertyOf, SKOS['semanticRelation'])) S18.append((SKOS['narrowerTransitive'], RDFS.subPropertyOf, SKOS['semanticRelation'])) S18.append((SKOS['related'], RDFS.subPropertyOf, SKOS['semanticRelation'])) statements.append(S18) # S19 skos:broader is a sub-property of skos:broaderTransitive, and skos:narrower is a sub-property of skos:narrowerTransitive. S19 = [] S19.append((SKOS['broader'], RDFS.subPropertyOf, SKOS['broaderTransitive'])) S19.append((SKOS['narrower'], RDFS.subPropertyOf, SKOS['narrowerTransitive'])) statements.append(S19) # S20 skos:related is an instance of owl:SymmetricProperty. S20 = [] S20.append((SKOS['related'], RDF.type, OWL['SymmetricProperty'])) statements.append(S20) # S21 skos:broader, skos:narrower and skos:related are each not instances of owl:TransitiveProperty. S21 = [] # no triples to add statements.append(S21) # S22 skos:broaderTransitive and skos:narrowerTransitive are each instances of owl:TransitiveProperty. S22 = [] S22.append((SKOS['broaderTransitive'], RDF.type, OWL['TransitiveProperty'])) S22.append((SKOS['narrowerTransitive'], RDF.type, OWL['TransitiveProperty'])) statements.append(S22) # S23 skos:narrower is the owl:inverseOf the property skos:broader. S23 = [] S23.append((SKOS['narrower'], OWL['inverseOf'], SKOS['broader'])) S23.append((SKOS['broader'], OWL['inverseOf'], SKOS['narrower'])) statements.append(S23) # S24 skos:narrowerTransitive is the owl:inverseOf the property skos:broaderTransitive. S24 = [] S24.append((SKOS['narrowerTransitive'], OWL['inverseOf'], SKOS['broaderTransitive'])) S24.append((SKOS['broaderTransitive'], OWL['inverseOf'], SKOS['narrowerTransitive'])) statements.append(S24) # S25 skos:related is disjoint with the property skos:broaderTransitive. S25 = [] # no triples to add statements.append(S25) # S26 skos:Collection and skos:OrderedCollection are each instances of owl:Class. S26 = [] S26.append((SKOS['Collection'], RDF.type, OWL['Class'])) S26.append((SKOS['OrderedCollection'], RDF.type, OWL['Class'])) statements.append(S26) # S27 skos:OrderedCollection is a sub-class of skos:Collection. S27 = [] S27.append((SKOS['OrderedCollection'], RDFS.subClassOf, SKOS['Collection'])) statements.append(S27) # S28 skos:member and skos:memberList are each instances of owl:ObjectProperty. S28 = [] S28.append((SKOS['member'], RDF.type, OWL['ObjectProperty'])) S28.append((SKOS['memberList'], RDF.type, OWL['ObjectProperty'])) statements.append(S28) # S29 The rdfs:domain of skos:member is the class skos:Collection. S29 = [] S29.append((SKOS['member'], RDFS.domain, SKOS['Collection'])) statements.append(S29) # S30 The rdfs:domain of skos:memberList is the class skos:OrderedCollection. S30 = [] S30.append((SKOS['memberList'], RDFS.domain, SKOS['OrderedCollection'])) statements.append(S30) # S31 The rdfs:range of skos:memberList is the class rdf:List. S31 = [] S31.append((SKOS['memberList'], RDFS.range, RDF.List)) statements.append(S31) # S32 skos:memberList is an instance of owl:FunctionalProperty. S32 = [] S32.append((SKOS['memberList'], RDF.type, OWL['FunctionalProperty'])) statements.append(S32) # S33 For any resource, every item in the list given as the value of the skos:memberList property is also a value of the skos:member property. S33 = [] # no triples to add statements.append(S33) # S34 skos:Collection is disjoint with each of skos:Concept and skos:ConceptScheme. S34 = [] S34.append((SKOS['Collection'], OWL['disjointWith'], SKOS['Concept'])) S34.append((SKOS['Collection'], OWL['disjointWith'], SKOS['ConceptScheme'])) statements.append(S34) # S35 skos:mappingRelation, skos:exactMatch, skos:broadMatch, skos:narrowMatch and skos:relatedMatch are each instances of owl:ObjectProperty. S35 = [] S35.append((SKOS['mappingRelation'], RDF.type, OWL['ObjectProperty'])) S35.append((SKOS['exactMatch'], RDF.type, OWL['ObjectProperty'])) S35.append((SKOS['broadMatch'], RDF.type, OWL['ObjectProperty'])) S35.append((SKOS['narrowMatch'], RDF.type, OWL['ObjectProperty'])) S35.append((SKOS['relatedMatch'], RDF.type, OWL['ObjectProperty'])) statements.append(S35) # S36 The rdfs:domain of skos:mappingRelation is the class skos:Concept. S36 = [] S36.append((SKOS['mappingRelation'], RDFS.domain, SKOS['Concept'])) statements.append(S36) # S37 The rdfs:range of skos:mappingRelation is the class skos:Concept S37 = [] S37.append((SKOS['mappingRelation'], RDFS.range, SKOS['Concept'])) statements.append(S37) # S38 skos:exactMatch, skos:broadMatch, skos:narrowMatch and skos:relatedMatch are each sub-properties of skos:mappingRelation. S38 = [] S38.append((SKOS['exactMatch'], RDFS.subPropertyOf, SKOS['mappingRelation'])) S38.append((SKOS['broadMatch'], RDFS.subPropertyOf, SKOS['mappingRelation'])) S38.append((SKOS['narrowMatch'], RDFS.subPropertyOf, SKOS['mappingRelation'])) S38.append((SKOS['relatedMatch'], RDFS.subPropertyOf, SKOS['mappingRelation'])) statements.append(S38) # S39 skos:broadMatch is a sub-property of skos:broader, skos:narrowMatch is a sub-property of skos:narrower, and skos:relatedMatch is a sub-property of skos:related. S39 = [] S39.append((SKOS['broadMatch'], RDFS.subPropertyOf, SKOS['broader'])) S39.append((SKOS['narrowMatch'], RDFS.subPropertyOf, SKOS['narrower'])) S39.append((SKOS['relatedMatch'], RDFS.subPropertyOf, SKOS['related'])) statements.append(S39) # S40 skos:narrowMatch is the owl:inverseOf the property skos:broadMatch. S40 = [] S40.append((SKOS['narrowMatch'], OWL['inverseOf'], SKOS['broadMatch'])) S40.append((SKOS['broadMatch'], OWL['inverseOf'], SKOS['narrowMatch'])) statements.append(S40) # S41 skos:relatedMatch is an instance of owl:SymmetricProperty. S41 = [] S41.append((SKOS['relatedMatch'], RDF.type, OWL['SymmetricProperty'])) statements.append(S41) # S42 skos:exactMatch is an instance of owl:SymmetricProperty. S42 = [] S42.append((SKOS['exactMatch'], RDF.type, OWL['SymmetricProperty'])) statements.append(S42) # S43 xl:Label is an instance of owl:Class. S43 = [] # no triples to add statements.append(S43) # S44 xl:Label is disjoint with each of skos:Concept, skos:ConceptScheme and skos:Collection. S44 = [] # no triples to add statements.append(S44) # S45 xl:literalForm is an instance of owl:DatatypeProperty. S45 = [] # no triples to add statements.append(S45) # S46 The rdfs:domain of xl:literalForm is the class xl:Label. S46 = [] # no triples to add statements.append(S46) # S47 The rdfs:range of xl:literalForm is the class of RDF plain literals. S47 = [] # no triples to add statements.append(S47) # S48 xl:literalForm is an instance of owl:FunctionalProperty. S48 = [] # no triples to add statements.append(S48) # S49 xl:prefLabel, xl:altLabel and xl:hiddenLabel are each instances of owl:ObjectProperty. S49 = [] # no triples to add statements.append(S49) # S50 The rdfs:range of each of xl:prefLabel, xl:altLabel and xl:hiddenLabel is the class xl:Label. S50 = [] # no triples to add statements.append(S50) # S51 The property chain (xl:prefLabel, xl:literalForm) is a sub-property of skos:prefLabel. S51 = [] # no triples to add statements.append(S51) # S52 The property chain (xl:altLabel, xl:literalForm) is a sub-property of skos:altLabel. S52 = [] # no triples to add statements.append(S52) # S53 The property chain (xl:hiddenLabel, xl:literalForm) is a sub-property of skos:hiddenLabel. S53 = [] # no triples to add statements.append(S53) # S54 xl:labelRelation is an instance of owl:ObjectProperty. S54 = [] # no triples to add statements.append(S54) # S55 The rdfs:domain of xl:labelRelation is the class xl:Label. S55 = [] # no triples to add statements.append(S55) # S56 The rdfs:range of xl:labelRelation is the class xl:Label. S56 = [] # no triples to add statements.append(S56) # S57 xl:labelRelation is an instance of owl:SymmetricProperty. S57 = [] # no triples to add statements.append(S57) return statements def schema() : schema = ConjunctiveGraph() for statement in statements() : for triple in statement : schema.add(triple) return schema # all done