@prefix :      <http://www.essepuntato.it/2008/12/pattern#> .
@prefix dc:    <http://purl.org/dc/elements/1.1/> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix swrl:  <http://www.w3.org/2003/11/swrl#> .
@prefix owl2xml: <http://www.w3.org/2006/12/owl2-xml#> .
@prefix pattern: <http://www.essepuntato.it/2008/12/pattern#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix swrlb: <http://www.w3.org/2003/11/swrlb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

pattern:Bucket  a         owl:Class ;
        rdfs:comment      "The class of elements that can contain other elements but no text nodes."@en ;
        rdfs:label        "bucket element"@en ;
        rdfs:subClassOf   pattern:Structured , pattern:NonTextual ;
        owl:disjointWith  pattern:Marker .

<urn:swrl#x>  a  swrl:Variable .

pattern:z  a    swrl:Variable .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Milestone
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Milestone
                          ] ;
               rdf:rest   ()
             
             ]
] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Block
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Block
                          ] ;
               rdf:rest   ()
             
             ]
] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Field
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Field
                          ] ;
               rdf:rest   ()
             
             ]
] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Table
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Table
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:canContainHeteronymousElements
        a             owl:FunctionalProperty , owl:DatatypeProperty ;
        rdfs:comment  "A hierarchical-based entity contains al least two entities having different names."@en ;
        rdfs:domain   pattern:Structured ;
        rdfs:label    "can contain heteronymous elements"@en ;
        rdfs:range    xsd:boolean .

<urn:swrl#s>  a  swrl:Variable .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                            swrl:argument1          pattern:p ;
                            swrl:argument2          pattern:x ;
                            swrl:propertyPredicate  pattern:contains
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                                         swrl:argument1          pattern:p ;
                                         swrl:argument2          pattern:y ;
                                         swrl:propertyPredicate  pattern:contains
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:x ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   [ a          swrl:AtomList ;
                                                      rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                                   swrl:argument1          pattern:y ;
                                                                   swrl:argument2          pattern:t ;
                                                                   swrl:propertyPredicate  pattern:hasName
                                                                 ] ;
                                                      rdf:rest   [ a          swrl:AtomList ;
                                                                   rdf:first  [ a               swrl:BuiltinAtom ;
                                                                                swrl:arguments  ( pattern:s pattern:t ) ;
                                                                                swrl:builtin    swrlb:notEqual
                                                                              ] ;
                                                                   rdf:rest   ()
                                                                 
                                                                 ]
                                                    ]
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                            swrl:argument1          pattern:p ;
                            swrl:argument2          true ;
                            swrl:propertyPredicate  pattern:canContainHeteronymousElements
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:NonStructured
        a                    owl:Class ;
        rdfs:comment         "The class of elements that cannot contain other elements."@en ;
        rdfs:label           "non-structured element"@en ;
        rdfs:subClassOf      pattern:Pattern ;
        owl:disjointWith     pattern:Structured ;
        owl:equivalentClass  [ a                 owl:Class ;
                               owl:complementOf  pattern:Structured
                             ] .

pattern:Mixed  a         owl:Class ;
        rdfs:comment     "The class of elements that can contain other elements and text nodes."@en ;
        rdfs:label       "mixed element"@en ;
        rdfs:subClassOf  pattern:Textual , pattern:Structured .

pattern:hasName  a    owl:FunctionalProperty , owl:DatatypeProperty ;
        rdfs:comment  "The name of a particular element."@en ;
        rdfs:label    "has name"@en ;
        rdfs:range    xsd:string .

pattern:Block  a             owl:Class ;
        rdfs:comment         "This class organise the document content as a sequence of nestable elements and text nodes. In particular, elements following this pattern can contain text and other elements compliant with the patterns Inline, Atom, Milestones and Popup, which will be introduced in the following. Furthermore, it is a requirement that block elements are contained only by container and popup elements"@en ;
        rdfs:label           "block element"@en ;
        rdfs:subClassOf      [ a                  owl:Restriction ;
                               owl:allValuesFrom  [ a            owl:Class ;
                                                    owl:unionOf  ( pattern:Atom pattern:Inline pattern:Milestone pattern:Popup )
                                                  ] ;
                               owl:onProperty     pattern:contains
                             ] ;
        owl:disjointWith     pattern:Inline ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Mixed [ a                  owl:Restriction ;
                                                                     owl:allValuesFrom  [ a            owl:Class ;
                                                                                          owl:unionOf  ( pattern:Container pattern:Popup )
                                                                                        ] ;
                                                                     owl:onProperty     pattern:isContainedBy
                                                                   ] )
                             ] .

pattern:p  a    swrl:Variable .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Inline
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Inline
                          ] ;
               rdf:rest   ()
             
             ]
] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Table
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:y ;
                                         swrl:propertyPredicate  pattern:contains
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                                                      swrl:argument1          pattern:x ;
                                                      swrl:argument2          pattern:z ;
                                                      swrl:propertyPredicate  pattern:contains
                                                    ] ;
                                         rdf:rest   [ a          swrl:AtomList ;
                                                      rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                                   swrl:argument1          pattern:z ;
                                                                   swrl:argument2          pattern:s ;
                                                                   swrl:propertyPredicate  pattern:hasName
                                                                 ] ;
                                                      rdf:rest   ()
                                                    
                                                    ]
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                            swrl:argument1          pattern:y ;
                            swrl:argument2          pattern:s ;
                            swrl:propertyPredicate  pattern:hasName
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:x  a    swrl:Variable .

pattern:Inline  a            owl:Class ;
        rdfs:comment         "This class has the same use and content model of the pattern Block, but differing primarily because a) inline elements can contain other elements compliant with the same pattern while block elements cannot, and b) inline elements must always be contained by other block or inline elements and by no other type of element.\n\nThese constraints also imply that inline elements cannot be used as root elements of documents and that the class Block is disjoint with the class Inline (i.e., a markup element cannot be a block and an inline at the same time)."@en ;
        rdfs:label           "inline element"@en ;
        rdfs:subClassOf      [ a                  owl:Restriction ;
                               owl:allValuesFrom  [ a            owl:Class ;
                                                    owl:unionOf  ( pattern:Atom pattern:Inline pattern:Milestone pattern:Popup )
                                                  ] ;
                               owl:onProperty     pattern:contains
                             ] ;
        rdfs:subClassOf      [ a                   owl:Restriction ;
                               owl:onProperty      pattern:isContainedBy ;
                               owl:someValuesFrom  [ a            owl:Class ;
                                                     owl:unionOf  ( pattern:Block pattern:Inline )
                                                   ]
                             ] ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Mixed [ a                  owl:Restriction ;
                                                                     owl:allValuesFrom  [ a            owl:Class ;
                                                                                          owl:unionOf  ( pattern:Block pattern:Inline )
                                                                                        ] ;
                                                                     owl:onProperty     pattern:isContainedBy
                                                                   ] )
                             ] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Record
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Record
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:isContainedBy
        a             owl:ObjectProperty ;
        rdfs:comment  "An element that is contained by another structured element."@en ;
        rdfs:label    "is contained by"@en .

pattern:Marker  a        owl:Class ;
        rdfs:comment     "The class of elements that can contain neither text nodes nor elements."@en ;
        rdfs:label       "marker element"@en ;
        rdfs:subClassOf  pattern:NonTextual , pattern:NonStructured .

pattern:Field  a             owl:Class ;
        rdfs:comment         "This class is defined to describe literal metadata or text that is not really part of the document body, contrarily to its disjointed sibling Atom. Its main difference with Meta is that Field can contain textual content."@en ;
        rdfs:label           "field element"@en ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Flat [ a                  owl:Restriction ;
                                                                    owl:allValuesFrom  [ a            owl:Class ;
                                                                                         owl:unionOf  ( pattern:Container pattern:Popup )
                                                                                       ] ;
                                                                    owl:onProperty     pattern:isContainedBy
                                                                  ] )
                             ] .

pattern:containsAsHeader
        a                   owl:ObjectProperty ;
        rdfs:comment        "A structured element contains another generic element as part of its header."@en ;
        rdfs:label          "contains as header"@en ;
        rdfs:subPropertyOf  pattern:contains ;
        owl:inverseOf       pattern:isContainedByAsHeader .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Container
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Container
                          ] ;
               rdf:rest   ()
             
             ]
] .

dc:creator  a   owl:AnnotationProperty .

pattern:s  a    swrl:Variable .

[ a            owl:AllDisjointClasses ;
  owl:members  ( pattern:HeadedContainer pattern:Record pattern:Table )
] .

pattern:Meta  a              owl:Class ;
        rdfs:comment         "This class describes elements that contain neither other elements nor textual content. Contrarily to the pattern Milestone, which was meant to describe markup elements that impact the document because of their location, the main feature of its disjoint sibling is the mere existence, independently from the position it has within the document. Meta elements convey metadata information about the document or part of it, independently of where they are. Thus, meta elements can be contained only within container elements."@en ;
        rdfs:label           "meta element"@en ;
        owl:disjointWith     pattern:Milestone ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Marker [ a                   owl:Restriction ;
                                                                      owl:onProperty      pattern:isContainedBy ;
                                                                      owl:someValuesFrom  [ a            owl:Class ;
                                                                                            owl:unionOf  ( pattern:Container pattern:Popup )
                                                                                          ]
                                                                    ] )
                             ] .

<urn:swrl#y>  a  swrl:Variable .

pattern:Atom  a              owl:Class ;
        rdfs:comment         "This class is defined to describe literal text that is part of the document body. Moreover, similarly to Inline, elements following the Atom pattern can only be contained within block or inline elements (and consequently they also cannot be used as root elements of documents). It can contain textual content and no other elements."@en ;
        rdfs:label           "atom element"@en ;
        rdfs:subClassOf      [ a                   owl:Restriction ;
                               owl:onProperty      pattern:isContainedBy ;
                               owl:someValuesFrom  [ a            owl:Class ;
                                                     owl:unionOf  ( pattern:Block pattern:Inline )
                                                   ]
                             ] ;
        owl:disjointWith     pattern:Field ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Flat [ a                  owl:Restriction ;
                                                                    owl:allValuesFrom  [ a            owl:Class ;
                                                                                         owl:unionOf  ( pattern:Block pattern:Inline )
                                                                                       ] ;
                                                                    owl:onProperty     pattern:isContainedBy
                                                                  ] )
                             ] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                            swrl:argument1          <urn:swrl#p> ;
                            swrl:argument2          <urn:swrl#x> ;
                            swrl:propertyPredicate  pattern:contains
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                                         swrl:argument1          <urn:swrl#p> ;
                                         swrl:argument2          <urn:swrl#y> ;
                                         swrl:propertyPredicate  pattern:contains
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          <urn:swrl#x> ;
                                                      swrl:argument2          <urn:swrl#s> ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   [ a          swrl:AtomList ;
                                                      rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                                   swrl:argument1          <urn:swrl#y> ;
                                                                   swrl:argument2          <urn:swrl#s> ;
                                                                   swrl:propertyPredicate  pattern:hasName
                                                                 ] ;
                                                      rdf:rest   ()
                                                    
                                                    ]
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                            swrl:argument1          <urn:swrl#p> ;
                            swrl:argument2          true ;
                            swrl:propertyPredicate  pattern:canContainHomonymousElements
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:HeadedContainer
        a                owl:Class ;
        rdfs:comment     "This class describes container elements whose content model need to begin with one or more block elements (the heading), specified through the property containsAsHeader."@en ;
        rdfs:label       "headed-container element"@en ;
        rdfs:subClassOf  [ a                   owl:Class ;
                           owl:intersectionOf  ( pattern:Container [ a                  owl:Restriction ;
                                                                     owl:allValuesFrom  pattern:Block ;
                                                                     owl:onProperty     pattern:containsAsHeader
                                                                   ] )
                         ] .

dc:description  a  owl:AnnotationProperty .

pattern:Container  a         owl:Class ;
        rdfs:comment         "This class concerns the structural organization of a document. Elements following this pattern contain no textual content and contain only elements compliant with the patterns: Meta, Field, Block and any subtype of Container. It is disjointed with the pattern Popup, although they share the same content model."@en ;
        rdfs:label           "container element"@en ;
        rdfs:subClassOf      [ a                  owl:Restriction ;
                               owl:allValuesFrom  [ a            owl:Class ;
                                                    owl:unionOf  ( pattern:Block pattern:Container pattern:Field pattern:Meta )
                                                  ] ;
                               owl:onProperty     pattern:contains
                             ] ;
        owl:disjointWith     pattern:Popup ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Bucket [ a                  owl:Restriction ;
                                                                      owl:allValuesFrom  [ a            owl:Class ;
                                                                                           owl:unionOf  ( pattern:Container pattern:Popup )
                                                                                         ] ;
                                                                      owl:onProperty     pattern:isContainedBy
                                                                    ] )
                             ] .

pattern:Record  a            owl:Class ;
        rdfs:comment         "This class describes container elements that can only contain heterogeneous and non repeatable elements."@en ;
        rdfs:label           "record element"@en ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Container [ a               owl:Restriction ;
                                                                         owl:hasValue    true ;
                                                                         owl:onProperty  pattern:canContainHeteronymousElements
                                                                       ] [ a               owl:Restriction ;
                                                                           owl:hasValue    false ;
                                                                           owl:onProperty  pattern:canContainHomonymousElements
                                                                         ] )
                             ] .

pattern:Milestone  a         owl:Class ;
        rdfs:comment         "This class describe elements that contain neither other elements nor textual content. Moreover, similarly to Inline, elements following the Milestone pattern can only be contained within block or inline elements (and consequently they also cannot be used as root elements of documents).\n\nThe distinctive characteristic of the pattern Milestone is the location it assumes within the document."@en ;
        rdfs:label           "milestone element"@en ;
        rdfs:subClassOf      [ a                   owl:Restriction ;
                               owl:onProperty      pattern:isContainedBy ;
                               owl:someValuesFrom  [ a            owl:Class ;
                                                     owl:unionOf  ( pattern:Block pattern:Inline )
                                                   ]
                             ] ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Marker [ a                  owl:Restriction ;
                                                                      owl:allValuesFrom  [ a            owl:Class ;
                                                                                           owl:unionOf  ( pattern:Block pattern:Inline )
                                                                                         ] ;
                                                                      owl:onProperty     pattern:isContainedBy
                                                                    ] )
                             ] .

pattern:NonTextual  a        owl:Class ;
        rdfs:comment         "The class of elements that cannot have textual content in their content models."@en ;
        rdfs:label           "non-textual element"@en ;
        rdfs:subClassOf      pattern:Pattern ;
        owl:disjointWith     pattern:Textual ;
        owl:equivalentClass  [ a                 owl:Class ;
                               owl:complementOf  pattern:Textual
                             ] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Table
                          ] ;
               rdf:rest   ()
             
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                            swrl:argument1          pattern:x ;
                            swrl:argument2          false ;
                            swrl:propertyPredicate  pattern:canContainHeteronymousElements
                          ] ;
               rdf:rest   ()
             
             ]
] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Meta
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                         swrl:argument1          pattern:x ;
                                         swrl:argument2          pattern:s ;
                                         swrl:propertyPredicate  pattern:hasName
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:y ;
                                                      swrl:argument2          pattern:s ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   ()
                                       
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Meta
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:contains  a    owl:ObjectProperty ;
        rdfs:comment   "A structured element contains another generic element."@en ;
        rdfs:domain    pattern:Structured ;
        rdfs:label     "contains"@en ;
        owl:inverseOf  pattern:isContainedBy .

owl:Thing  a    owl:Class .

pattern:Table  a             owl:Class ;
        rdfs:comment         "This class describes container elements that must contain only homogeneous elements (but they can be repeated)."@en ;
        rdfs:label           "table element"@en ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Container [ a               owl:Restriction ;
                                                                         owl:hasValue    false ;
                                                                         owl:onProperty  pattern:canContainHeteronymousElements
                                                                       ] [ a               owl:Restriction ;
                                                                           owl:hasValue    true ;
                                                                           owl:onProperty  pattern:canContainHomonymousElements
                                                                         ] )
                             ] .

pattern:y  a    swrl:Variable .

<http://www.essepuntato.it/2008/12/pattern>
        a                           owl:Ontology ;
        rdfs:comment                "An ontology defining formally patterns for segmenting a document into atomic components, in order to be manipulated independently and re-flowed in different contexts."@en ;
        rdfs:label                  "pattern ontology"@en ;
        dc:creator                  "Fabio Vitali"^^xsd:string , "Angelo Di Iorio"^^xsd:string , "Silvio Peroni"^^xsd:string ;
        dc:date                     "2013-07-16" ;
        dc:description              "The idea of using patterns to produce reusable and high-quality assets is not new in the literature. Software engineers, architects (as Alexander who first introduced this term) and designers very often use – or rather reuse – patterns to handle problems which recur over and over. Patterns have also been studied to modularize and customize web ontologies (http://ontologydesignpatterns.org). They guarantee the flexibility and maintainability of concepts and solutions in several heterogeneous scenarios.\n\nWe've been investigating patterns for XML documents for some time. The overall goal of this research is to understand how the structure of digital documents can be segmented into atomic components, that can be manipulated independently and re-flowed in different contexts. Instead of defining a large number of complex and diversified structures, we have identified a small number of structures/patterns that are sufficient to express what most users need. Our idea is that a low number of patterns are enough to capture the most relevant document structures."@en ;
        dc:title                    "The Pattern Ontology\nDescribing documents by means of their structural components"@en ;
        owl:backwardCompatibleWith  <http://dwellonit.svn.sourceforge.net/viewvc/dwellonit/StructuralPattern/Pattern-1_4.owl> ;
        owl:priorVersion            <http://dwellonit.svn.sourceforge.net/viewvc/dwellonit/StructuralPattern/Pattern-1_4.owl> ;
        owl:versionInfo             "1.4.2"^^xsd:string .

dc:date  a      owl:AnnotationProperty .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:x ;
                            swrl:classPredicate  pattern:Record
                          ] ;
               rdf:rest   ()
             
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                            swrl:argument1          pattern:x ;
                            swrl:argument2          false ;
                            swrl:propertyPredicate  pattern:canContainHomonymousElements
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:t  a    swrl:Variable .

rdfs:comment  a  owl:AnnotationProperty .

pattern:canContainHomonymousElements
        a             owl:FunctionalProperty , owl:DatatypeProperty ;
        rdfs:comment  "A hierarchical-based entity contains al least two entities that share the same name."@en ;
        rdfs:domain   pattern:Structured ;
        rdfs:label    "can contain homonymous elements"@en ;
        rdfs:range    xsd:boolean .

pattern:g  a    swrl:Variable .

dc:title  a     owl:AnnotationProperty .

owl:versionInfo  a  owl:AnnotationProperty .

pattern:Popup  a             owl:Class ;
        rdfs:comment         "This class defines bucket elements that are only present within block and inline elements. Popup elements are used whenever complex structures need to be placed within content elements such as paragraphs. "@en ;
        rdfs:label           "popup element"@en ;
        rdfs:subClassOf      [ a                  owl:Restriction ;
                               owl:allValuesFrom  [ a            owl:Class ;
                                                    owl:unionOf  ( pattern:Block pattern:Container pattern:Field pattern:Meta )
                                                  ] ;
                               owl:onProperty     pattern:contains
                             ] ;
        rdfs:subClassOf      [ a                   owl:Restriction ;
                               owl:onProperty      pattern:isContainedBy ;
                               owl:someValuesFrom  [ a            owl:Class ;
                                                     owl:unionOf  ( pattern:Block pattern:Inline )
                                                   ]
                             ] ;
        owl:equivalentClass  [ a                   owl:Class ;
                               owl:intersectionOf  ( pattern:Bucket [ a                  owl:Restriction ;
                                                                      owl:allValuesFrom  [ a            owl:Class ;
                                                                                           owl:unionOf  ( pattern:Block pattern:Inline )
                                                                                         ] ;
                                                                      owl:onProperty     pattern:isContainedBy
                                                                    ] )
                             ] .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Pattern
                          ] ;
               rdf:rest   [ a          swrl:AtomList ;
                            rdf:first  [ a                    swrl:ClassAtom ;
                                         swrl:argument1       pattern:x ;
                                         swrl:classPredicate  pattern:Textual
                                       ] ;
                            rdf:rest   [ a          swrl:AtomList ;
                                         rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                      swrl:argument1          pattern:x ;
                                                      swrl:argument2          pattern:g ;
                                                      swrl:propertyPredicate  pattern:hasName
                                                    ] ;
                                         rdf:rest   [ a          swrl:AtomList ;
                                                      rdf:first  [ a                       swrl:DatavaluedPropertyAtom ;
                                                                   swrl:argument1          pattern:y ;
                                                                   swrl:argument2          pattern:g ;
                                                                   swrl:propertyPredicate  pattern:hasName
                                                                 ] ;
                                                      rdf:rest   ()
                                                    
                                                    ]
                                       ]
                          ]
             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       pattern:y ;
                            swrl:classPredicate  pattern:Textual
                          ] ;
               rdf:rest   ()
             
             ]
] .

pattern:Flat  a           owl:Class ;
        rdfs:comment      "The class of elements that can contain text nodes but no elements."@en ;
        rdfs:label        "flat element"@en ;
        rdfs:subClassOf   pattern:Textual , pattern:NonStructured ;
        owl:disjointWith  pattern:Mixed .

pattern:isContainedByAsHeader
        a                   owl:ObjectProperty ;
        rdfs:comment        "An element is contained by another structured element as part of its header."@en ;
        rdfs:label          "is contained by as header"@en ;
        rdfs:subPropertyOf  pattern:isContainedBy .

pattern:Textual  a       owl:Class ;
        rdfs:comment     "The class of elements that can have textual content in their content models."@en ;
        rdfs:label       "textual element"@en ;
        rdfs:subClassOf  pattern:Pattern .

<urn:swrl#p>  a  swrl:Variable .

pattern:Pattern  a       owl:Class ;
        rdfs:comment     "A structural pattern is an atomic component of a document, that is able to capture a recurrent and well knwon structure of a document.\n\nAny entity belonging to this class is compliant with exactly one structural pattern."@en ;
        rdfs:label       "pattern-based element"@en ;
        rdfs:subClassOf  owl:Thing .

rdfs:label  a   owl:AnnotationProperty .

pattern:Structured  a    owl:Class ;
        rdfs:comment     "The class of elements that can contain other elements."@en ;
        rdfs:label       "structured element"@en ;
        rdfs:subClassOf  pattern:Pattern .
