Ver código fonte

add has* properties to OWL and RDF

Harshvardhan Pandit 7 anos atrás
pai
commit
286ad071b8

Diferenças do arquivo suprimidas por serem muito extensas
+ 273 - 385
deliverables/gdpr.jsonld


Diferenças do arquivo suprimidas por serem muito extensas
+ 367 - 211
deliverables/gdpr.n3


Diferenças do arquivo suprimidas por serem muito extensas
+ 839 - 1172
deliverables/gdpr.nt


+ 98 - 5
deliverables/gdpr.owl

@@ -1,18 +1,17 @@
 <?xml version="1.0"?>
 <rdf:RDF xmlns="http://purl.org/adaptcentre/ontologies/GDPRtEXT#"
      xml:base="http://purl.org/adaptcentre/ontologies/GDPRtEXT"
-     xmlns:eli="http://data.europa.eu/eli/ontology#"
-     xmlns:GDPRtEXT="http://purl.org/adaptcentre/ontologies/GDPRtEXT#"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:owl="http://www.w3.org/2002/07/owl#"
      xmlns:xml="http://www.w3.org/XML/1998/namespace"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-     xmlns:dc="http://purl.org/dc/elements/1.1/">
+     xmlns:dc="http://purl.org/dc/elements/1.1/"
+     xmlns:gdprtext="http://purl.org/adaptcentre/ontologies/GDPRtEXT#">
     <owl:Ontology rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#">
         <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GDPRtEXT</dc:title>
         <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This is an ontology to represent GDPR text as a set of RDF resources</rdfs:comment>
-        <dc:description rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">This ontology extends the canonical (official) GDPR text with additional annotations</dc:description>
+        <dc:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This ontology extends the canonical (official) GDPR text with additional annotations</dc:description>
         <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GDPR text EXTensions</rdfs:label>
         <dc:creator rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Harshvardhan J. Pandit</dc:creator>
         <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.1</owl:versionInfo>
@@ -31,9 +30,97 @@
     
 
 
+    <!-- http://data.europa.eu/eli/ontology#has_part -->
+
+    <owl:ObjectProperty rdf:about="http://data.europa.eu/eli/ontology#has_part">
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
+    </owl:ObjectProperty>
+    
+
+
     <!-- http://data.europa.eu/eli/ontology#is_part_of -->
 
-    <owl:ObjectProperty rdf:about="http://data.europa.eu/eli/ontology#is_part_of"/>
+    <owl:ObjectProperty rdf:about="http://data.europa.eu/eli/ontology#is_part_of">
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasArticle -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasArticle">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#Article"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the Article</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has Article</rdfs:label>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasChapter -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasChapter">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResource"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#Chapter"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the Chapter</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has Chapter</rdfs:label>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasPoint -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasPoint">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#Point"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the Point</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has Point</rdfs:label>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasRecital -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasRecital">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#Recital"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the Recital</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has Recital</rdfs:label>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasSection -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasSection">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#Section"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the Section</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has Section</rdfs:label>
+    </owl:ObjectProperty>
+    
+
+
+    <!-- http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasSubPoint -->
+
+    <owl:ObjectProperty rdf:about="http://purl.org/adaptcentre/ontologies/GDPRtEXT#hasSubPoint">
+        <rdfs:subPropertyOf rdf:resource="http://data.europa.eu/eli/ontology#has_part"/>
+        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+        <rdfs:domain rdf:resource="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>
+        <rdfs:range rdf:resource="http://purl.org/adaptcentre/ontologies/GDPRtEXT#SubPoint"/>
+        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">indicates the legal resource has the SubPoint</rdfs:comment>
+        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has SubPoint</rdfs:label>
+    </owl:ObjectProperty>
     
 
 
@@ -100,6 +187,12 @@
     
 
 
+    <!-- http://data.europa.eu/eli/ontology#LegalResource -->
+
+    <owl:Class rdf:about="http://data.europa.eu/eli/ontology#LegalResource"/>
+    
+
+
     <!-- http://data.europa.eu/eli/ontology#LegalResourceSubdivision -->
 
     <owl:Class rdf:about="http://data.europa.eu/eli/ontology#LegalResourceSubdivision"/>

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 2
deliverables/gdpr.rdf


Diferenças do arquivo suprimidas por serem muito extensas
+ 367 - 211
deliverables/gdpr.ttl


+ 70 - 1
scripts/generate_owl.py

@@ -41,7 +41,9 @@ TITLE = ELI.title
 NOS = ELI.number
 TITLE_ALT = ELI.title_alternative
 PART_OF = ELI.is_part_of
-# graph.add((PART_OF, RDF.type, OWL.TransitiveProperty))
+graph.add((PART_OF, RDF.type, OWL.TransitiveProperty))
+HAS_PART = ELI.has_part
+graph.add((HAS_PART, RDF.type, OWL.TransitiveProperty))
 DESC = ELI.description
 
 # declare chapters, etc. as subclasses of LRS
@@ -148,4 +150,71 @@ graph.add((property_partof_point, RDFS.comment, Literal(
     'represents a legal resource subdivision to be part of a point',
     datatype=XSD.string)))
 
+property_has_chapter = GDPRtEXT['hasChapter']
+graph.add((property_has_chapter, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_chapter, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_chapter, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_chapter, RDFS.domain, ELI.LegalResource))
+graph.add((property_has_chapter, RDFS.range, class_Chapter))
+graph.add((property_has_chapter, RDFS.label, Literal(
+    'has Chapter', datatype=XSD.string)))
+graph.add((property_has_chapter, RDFS.comment, Literal(
+    'indicates the legal resource has the Chapter', datatype=XSD.string)))
+
+property_has_section = GDPRtEXT['hasSection']
+graph.add((property_has_section, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_section, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_section, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_section, RDFS.domain, LRS))
+graph.add((property_has_section, RDFS.range, class_Section))
+graph.add((property_has_section, RDFS.label, Literal(
+    'has Section', datatype=XSD.string)))
+graph.add((property_has_section, RDFS.comment, Literal(
+    'indicates the legal resource has the Section', datatype=XSD.string)))
+
+property_has_article = GDPRtEXT['hasArticle']
+graph.add((property_has_article, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_article, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_article, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_article, RDFS.domain, LRS))
+graph.add((property_has_article, RDFS.range, class_Article))
+graph.add((property_has_article, RDFS.label, Literal(
+    'has Article', datatype=XSD.string)))
+graph.add((property_has_article, RDFS.comment, Literal(
+    'indicates the legal resource has the Article', datatype=XSD.string)))
+
+property_has_point = GDPRtEXT['hasPoint']
+graph.add((property_has_point, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_point, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_point, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_point, RDFS.domain, LRS))
+graph.add((property_has_point, RDFS.range, class_Point))
+graph.add((property_has_point, RDFS.label, Literal(
+    'has Point', datatype=XSD.string)))
+graph.add((property_has_point, RDFS.comment, Literal(
+    'indicates the legal resource has the Point', datatype=XSD.string)))
+
+property_has_subpoint = GDPRtEXT['hasSubPoint']
+graph.add((property_has_subpoint, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_subpoint, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_subpoint, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_subpoint, RDFS.domain, LRS))
+graph.add((property_has_subpoint, RDFS.range, class_SubPoint))
+graph.add((property_has_subpoint, RDFS.label, Literal(
+    'has SubPoint', datatype=XSD.string)))
+graph.add((property_has_subpoint, RDFS.comment, Literal(
+    'indicates the legal resource has the SubPoint', datatype=XSD.string)))
+
+property_has_recital = GDPRtEXT['hasRecital']
+graph.add((property_has_recital, RDF.type, OWL.ObjectProperty))
+graph.add((property_has_recital, RDF.type, OWL.FunctionalProperty))
+graph.add((property_has_recital, RDFS.subPropertyOf, HAS_PART))
+graph.add((property_has_recital, RDFS.domain, LRS))
+graph.add((property_has_recital, RDFS.range, class_Recital))
+graph.add((property_has_recital, RDFS.label, Literal(
+    'has Recital', datatype=XSD.string)))
+graph.add((property_has_recital, RDFS.comment, Literal(
+    'indicates the legal resource has the Recital', datatype=XSD.string)))
+
+
 graph.serialize(destination='../deliverables/gdpr.owl', format='xml')

+ 26 - 35
scripts/generate_rdf_pairings.py

@@ -58,6 +58,7 @@ TITLE_ALT = ELI.title_alternative
 PART_OF = ELI.is_part_of
 # graph.add((PART_OF, RDF.type, OWL.TransitiveProperty))
 DESC = ELI.description
+HAS_RECITAL = GDPRtEXT['hasRecital']
 
 ##############################################################################
 # GDPR as named individual
@@ -94,46 +95,22 @@ graph.add((gdpr, DCTERMS.abstract, Literal((
     'personal data and on the free movement of such data, '
     'and repealing Directive 95/46/EC '
     '(General Data Protection Regulation)'), datatype=XSD.string)))
-gdpr_description = BNode()
-graph.add((gdpr_description, RDF.type, RDF.Statement))
-gdpr_description1 = BNode()
-graph.add((gdpr_description1, RDF.type, RDF.Statement))
-graph.add((gdpr_description1, DCTERMS.description, Literal((
+gdpr_description = GDPR['description']
+graph.add((gdpr_description, RDF.type, ELI.LRS))
+graph.add((gdpr_description, DCTERMS.description, Literal((
     'THE EUROPEAN PARLIAMENT AND THE COUNCIL OF THE EUROPEAN UNION, '
     'Having regard to the Treaty on the Functioning of the European Union, '
     'and in particular Article 16 thereof, Having regard to the proposal from '
     'the European Commission, After transmission of the draft legislative act '
-    'to the national parliaments,'), datatype=XSD.string)))
-graph.add((gdpr_description1, DCTERMS.isPartOf, gdpr_description))
-graph.add((gdpr_description, DCTERMS.hasPart, gdpr_description1))
-gdpr_description2 = BNode()
-graph.add((gdpr_description2, RDF.type, RDF.Statement))
-graph.add((gdpr_description2, DCTERMS.description, Literal((
+    'to the national parliaments, '
     'Having regard to the opinion of the European Economic '
-    'and Social Committee,'), datatype=XSD.string)))
-graph.add((gdpr_description2, DCTERMS.isPartOf, gdpr_description))
-graph.add((gdpr_description, DCTERMS.hasPart, gdpr_description2))
-graph.add((gdpr_description2, DCTERMS.references, GDPR['citation1']))
-graph.add((gdpr_description2, ELI.cites, GDPR['citation1']))
-gdpr_description3 = BNode()
-graph.add((gdpr_description3, RDF.type, RDF.Statement))
-graph.add((gdpr_description3, DCTERMS.description, Literal(
-    'Having regard to the opinion of the Committee of the Regions,',
-    datatype=XSD.string)))
-graph.add((gdpr_description3, DCTERMS.isPartOf, gdpr_description))
-graph.add((gdpr_description, DCTERMS.hasPart, gdpr_description3))
-graph.add((gdpr_description3, DCTERMS.references, GDPR['citation2']))
-graph.add((gdpr_description3, ELI.cites, GDPR['citation2']))
-graph.add((gdpr, DCTERMS.description, gdpr_description))
-gdpr_description4 = BNode()
-graph.add((gdpr_description4, RDF.type, RDF.Statement))
-graph.add((gdpr_description4, DCTERMS.description, Literal(
-    'Acting in accordance with the ordinary legislative procedure,',
-    datatype=XSD.string)))
-graph.add((gdpr_description4, DCTERMS.isPartOf, gdpr_description))
-graph.add((gdpr_description, DCTERMS.hasPart, gdpr_description4))
-graph.add((gdpr_description4, DCTERMS.references, GDPR['citation3']))
-graph.add((gdpr_description4, ELI.cites, GDPR['citation3']))
+    'and Social Committee, '
+    'Having regard to the opinion of the Committee of the Regions, '
+    'Acting in accordance with the ordinary legislative procedure,'
+    ),  datatype=XSD.string)))
+graph.add((gdpr_description, ELI.cites, GDPR['citation1']))
+graph.add((gdpr_description, ELI.cites, GDPR['citation2']))
+graph.add((gdpr_description, ELI.cites, GDPR['citation3']))
 graph.add((gdpr, DCTERMS.description, gdpr_description))
 graph.add((gdpr, ELI.date_document, Literal('2016-04-27', datatype=XSD.date)))
 graph.add((gdpr, DCTERMS.date, Literal('2016-04-27', datatype=XSD.date)))
@@ -157,6 +134,11 @@ property_partof_chapter = GDPRtEXT['isPartOfChapter']
 property_partof_section = GDPRtEXT['isPartOfSection']
 property_partof_article = GDPRtEXT['isPartOfArticle']
 property_partof_point = GDPRtEXT['isPartOfPoint']
+property_has_chapter = GDPRtEXT['hasChapter']
+property_has_section = GDPRtEXT['hasSection']
+property_has_article = GDPRtEXT['hasArticle']
+property_has_point = GDPRtEXT['hasPoint']
+property_has_subpoint = GDPRtEXT['hasSubPoint']
 
 #############################################################################
 
@@ -194,6 +176,7 @@ def graph_subpoint(
     graph.add((node_subpoint, property_partof_article, article))
     graph.add((node_subpoint, PART_OF, point))
     graph.add((node_subpoint, property_partof_point, point))
+    graph.add((point, property_has_subpoint, node_subpoint))
     graph.add((node_subpoint, PART_OF, gdpr))
     graph.add((node_subpoint, DESC, Literal(
         subpoint['text'], datatype=XSD.string)))
@@ -218,6 +201,7 @@ def graph_point(point, article_number, article, section=None, chapter=None):
         graph.add((node_point, property_partof_section, section))
     graph.add((node_point, PART_OF, article))
     graph.add((node_point, property_partof_article, article))
+    graph.add((article, property_has_point, node_point))
     graph.add((node_point, PART_OF, gdpr))
     graph.add((node_point, DESC, Literal(
         point['text'], datatype=XSD.string)))
@@ -244,10 +228,13 @@ def graph_article(article, section=None, chapter=None):
         'Article ' + article['number'], datatype=XSD.string)))
     graph.add((node_article, PART_OF, chapter))
     graph.add((node_article, property_partof_chapter, chapter))
+    graph.add((chapter, property_has_article, node_article))
+    graph.add((gdpr, property_has_article, node_article))
     graph.add((node_article, PART_OF, gdpr))
     if section is not None:
         graph.add((node_article, PART_OF, section))
         graph.add((node_article, property_partof_section, section))
+        graph.add((section, property_has_article, node_article))
     # point number for when points are unnumbered
     point_nos = 1
     for point in article['contents']:
@@ -273,6 +260,7 @@ def graph_section(section, chapter, chapter_number):
     graph.add((node_section, PART_OF, chapter))
     graph.add((node_section, PART_OF, gdpr))
     graph.add((node_section, property_partof_chapter, chapter))
+    graph.add((chapter, property_has_section, node_section))
     for article in section['contents']:
         graph_article(article, node_section, chapter)
 
@@ -290,6 +278,7 @@ def graph_chapter(chapter):
     graph.add((node_chapter, TITLE_ALT, Literal(
         'Chapter ' + chapter['number'], datatype=XSD.string)))
     graph.add((node_chapter, PART_OF, gdpr))
+    graph.add((gdpr, property_has_chapter, node_chapter))
 
     contents = chapter['contents']
     # Section (if any)
@@ -314,6 +303,7 @@ for recital in gdpr_json['recitals']:
     graph.add((node_recital, DESC, Literal(
         recital['text'], datatype=XSD.string)))
     graph.add((node_recital, PART_OF, gdpr))
+    graph.add((gdpr, HAS_RECITAL, node_recital))
 
 
 for citation in gdpr_json['citations'].values():
@@ -325,6 +315,7 @@ for citation in gdpr_json['citations'].values():
     graph.add((node_citation, DESC, Literal(
         citation['text'], datatype=XSD.string)))
     graph.add((node_citation, PART_OF, gdpr))
+    graph.add((gdpr, ELI.cites, node_citation))
 
 
 # Add citations

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff