From c1e229100dc305f6c485d68f6a963e80a77f39bb Mon Sep 17 00:00:00 2001 From: Timo Date: Fri, 19 Jan 2024 19:18:15 +0100 Subject: [PATCH] fixes --- src/sparqlunicorn_ontdoc/doc/docconfig.py | 91 +++++++++++++++-------- src/sparqlunicorn_ontdoc/docgeneration.py | 14 +++- 2 files changed, 73 insertions(+), 32 deletions(-) diff --git a/src/sparqlunicorn_ontdoc/doc/docconfig.py b/src/sparqlunicorn_ontdoc/doc/docconfig.py index 77984e64..23d48340 100644 --- a/src/sparqlunicorn_ontdoc/doc/docconfig.py +++ b/src/sparqlunicorn_ontdoc/doc/docconfig.py @@ -42,46 +42,79 @@ class DocConfig: "https://www.w3.org/ns/activitystreams#OrderedCollection": "collection" } - classToCollectionClass={ - "http://www.opengis.net/ont/geosparql#SpatialObject": {"class": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection","prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/geosparql#Feature":{"class":"http://www.opengis.net/ont/geosparql#FeatureCollection","prop":"http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/geosparql#Geometry": {"class":"http://www.opengis.net/ont/geosparql#GeometryCollection","prop":"http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#Point": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection","prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#Envelope": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + classToCollectionClass = { + "http://www.opengis.net/ont/geosparql#SpatialObject": { + "class": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/geosparql#Feature": { + "class": "http://www.opengis.net/ont/geosparql#FeatureCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/geosparql#Geometry": { + "class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#Point": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#Envelope": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#Geometry": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#Line": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#LineString": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#LinearRing": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#MultiCurve": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#MultiLineString": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#MultiLineString": { + "class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#MultiPoint": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#MultiPolygon": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#MultiSurface": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#MultiPolygon": { + "class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#MultiSurface": { + "class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#Polygon": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.opengis.net/ont/sf#PolyhedralSurface": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.opengis.net/ont/sf#PolyhedralSurface": { + "class": "http://www.opengis.net/ont/geosparql#GeometryCollection", + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#Surface": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#TIN": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://www.opengis.net/ont/sf#Triangle": {"class": "http://www.opengis.net/ont/geosparql#GeometryCollection", - "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, - "http://www.w3.org/2006/vcard/ns#Individual": {"class":"http://www.w3.org/2006/vcard/ns#Group","prop":"http://www.w3.org/2006/vcard/ns#hasMember"}, - "http://xmlns.com/foaf/0.1/Person": {"class":"http://www.w3.org/2006/vcard/ns#Group","prop":"http://www.w3.org/2006/vcard/ns#hasMember"}, - "http://www.w3.org/ns/lemon/ontolex#LexicalEntry": {"class":"http://www.w3.org/ns/lemon/lime#Lexicon","prop":"http://www.w3.org/ns/lemon/lexicog#entry"}, - "http://www.w3.org/ns/dcat#Dataset": {"class":"http://www.w3.org/ns/dcat#Catalog","prop":"http://www.w3.org/ns/dcat#dataset"}, - "http://www.w3.org/ns/sosa/Observation":{"class":"http://www.w3.org/ns/sosa/ObservationCollection","prop":"http://www.w3.org/2000/01/rdf-schema#member"}, + "super": "http://www.opengis.net/ont/geosparql#SpatialObjectCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, + "http://www.w3.org/2006/vcard/ns#Individual": {"class": "http://www.w3.org/2006/vcard/ns#Group", + "prop": "http://www.w3.org/2006/vcard/ns#hasMember"}, + "http://xmlns.com/foaf/0.1/Person": {"class": "http://www.w3.org/2006/vcard/ns#Group", + "prop": "http://www.w3.org/2006/vcard/ns#hasMember"}, + "http://www.w3.org/ns/lemon/ontolex#LexicalEntry": {"class": "http://www.w3.org/ns/lemon/lime#Lexicon", + "prop": "http://www.w3.org/ns/lemon/lexicog#entry"}, + "http://www.w3.org/ns/dcat#Dataset": {"class": "http://www.w3.org/ns/dcat#Catalog", + "prop": "http://www.w3.org/ns/dcat#dataset"}, + "http://www.w3.org/ns/sosa/Observation": {"class": "http://www.w3.org/ns/sosa/ObservationCollection", + "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://purl.org/ontology/bibo/Document": {"class": "http://purl.org/ontology/bibo/Collection", "prop": "http://www.w3.org/2000/01/rdf-schema#member"}, "http://purl.org/ontology/bibo/Article": {"class": "http://purl.org/ontology/bibo/Collection", diff --git a/src/sparqlunicorn_ontdoc/docgeneration.py b/src/sparqlunicorn_ontdoc/docgeneration.py index 133d9f6d..f0f1c2da 100644 --- a/src/sparqlunicorn_ontdoc/docgeneration.py +++ b/src/sparqlunicorn_ontdoc/docgeneration.py @@ -544,9 +544,17 @@ def createCollections(self,graph,namespace): graph.add((URIRef("http://www.opengis.net/ont/geosparql#GeometryCollection"), URIRef("http://www.w3.org/2000/01/rdf-schema#subClassOf"),URIRef("http://www.opengis.net/ont/geosparql#SpatialObjectCollection"))) graph.add((URIRef(colluri), URIRef(self.typeproperty),URIRef("http://www.opengis.net/ont/geosparql#GeometryCollection"))) elif cls in DocConfig.classToCollectionClass: - graph.add((URIRef(DocConfig.classToCollectionClass[cls]["class"]), - URIRef("http://www.w3.org/2000/01/rdf-schema#subClassOf"), - URIRef("http://www.w3.org/2004/02/skos/core#Collection"))) + if "super" in DocConfig.classToCollectionClass[cls]: + graph.add((URIRef(DocConfig.classToCollectionClass[cls]["class"]), + URIRef("http://www.w3.org/2000/01/rdf-schema#subClassOf"), + URIRef(DocConfig.classToCollectionClass[cls]["super"]))) + graph.add((URIRef(DocConfig.classToCollectionClass[cls]["super"]), + URIRef("http://www.w3.org/2000/01/rdf-schema#subClassOf"), + URIRef("http://www.w3.org/2004/02/skos/core#Collection"))) + else: + graph.add((URIRef(DocConfig.classToCollectionClass[cls]["class"]), + URIRef("http://www.w3.org/2000/01/rdf-schema#subClassOf"), + URIRef("http://www.w3.org/2004/02/skos/core#Collection"))) graph.add((URIRef(colluri),URIRef(self.typeproperty),URIRef(DocConfig.classToCollectionClass[cls]["class"]))) collrelprop=DocConfig.classToCollectionClass[cls]["prop"] else: