Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

2014.10 - How to Formulate and Validate Constraints (DC 2014)

463 Aufrufe

Veröffentlicht am

How to Formulate and Validate Constraints (DC 2014)

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

2014.10 - How to Formulate and Validate Constraints (DC 2014)

  1. 1. how to formulate and validate constraints?
  2. 2. R-28-OBJECT-PROPERTY-RANGE DSP, OWL 2, SPIN, SPARQL
  3. 3. valid data :myAddress a :PostalAddress ; :addressCountry :netherlands . :netherlands a :Country .
  4. 4. constraint (DSP) :postalAddress a dsp:DescriptionTemplate ; dsp:minOccur 1 ; dsp:maxOccur "infinity” ; dsp:resourceClass :PostalAddress ; dsp:statementTemplate [ a dsp:NonLiteralStatementTemplate ; dsp:minOccur 1 ; dsp:maxOccur "infinity" ; dsp:property :addressCountry ; dsp:nonLiteralConstraint [ a dsp:NonLiteralConstraint ; dsp:valueClass :Country ] ] .
  5. 5. invalid data :myAddress a :PostalAddress ; :addressCountry :amsterdam . :amsterdam a :Locality . ----- :myAddress a :PostalAddress ; :addressCountry :amsterdam .
  6. 6. constraint (OWL2) :addressCountry a owl:ObjectProperty ; rdfs:range :Country .
  7. 7. validation validator purl.org/net/rdfval-demo executable examples R-28-OBJECT-PROPERTY-RANGE
  8. 8. R-68-REQUIRED-PROPERTIES Bibframe, DQTP, DSP, OWL 2, ReSh, ShEx, SPIN, SPARQL
  9. 9. valid data :dcmi a :Organization ; :name "Dublin Core Metadata Initiative" .
  10. 10. constraint (DSP) :organizationDescriptionTemplate a dsp:DescriptionTemplate ; dsp:minOccur 1 ; dsp:maxOccur "infinity" ; dsp:resourceClass :Organization ; dsp:statementTemplate [ a dsp:NonLiteralStatementTemplate; dsp:minOccur 1 ; dsp:maxOccur "infinity" ; dsp:property :name ] .
  11. 11. invalid data :dcmi a :Organization .
  12. 12. constraint (OWL2) :Organization rdfs:subClassOf [ a owl:Restriction ; owl:minCardinality 1 ; owl:onProperty :name ] .
  13. 13. validation validator purl.org/net/rdfval-demo executable examples R-68-REQUIRED-PROPERTIES
  14. 14. R-38-DEFAULT-VALUES-OF- RDF-LITERALS SPIN, SPARQL
  15. 15. constraint owl:Thing spin:rule [ a sp:Construct ; sp:text """ CONSTRUCT { ?this :laserSwordColor "blue" ; ?this :numberLaserSwords 1 . } WHERE { ?this a :Jedi . } """ ; ] .
  16. 16. data :Joda a :Jedi , owl:Thing . inferred triples :Joda :laserSwordColor "blue" ; :numberLaserSwords 1.
  17. 17. constraint owl:Thing spin:rule [ a sp:Construct ; sp:text """ CONSTRUCT { ?this :laserSwordColor “red" ; ?this :numberLaserSwords 2 . } WHERE { ?this a :Sith . } """ ; ] .
  18. 18. data :DarthSidious a :Sith , owl:Thing . inferred triples :DarthSidious :laserSwordColor “red" ; :numberLaserSwords 2.
  19. 19. validation examples R-38-DEFAULT-VALUES-OF-RDF-LITERALS
  20. 20. R-52-NEGATIVE-OBJECT-PROPERTY- CONSTRAINTS ShEx, SPIN, SPARQL
  21. 21. constraint <FeelingForce> { :feelingForce (true) , :attitute xsd:string } <JediMentor> { :feelingForce (true) , :attitute ('good') , :laserSwordColor xsd:string , :numberLaserSwords xsd:nonNegativeInteger , :mentorOf @<JediStudent> , !:studentOf @<JediMentor> }
  22. 22. matching 'JediMentor' shape :Obi-Wan :feelingForce true ; :attitute 'good' ; :laserSwordColor 'blue' ; :numberLaserSwords 1 ; :mentorOf :Anakin .
  23. 23. constraint <JediStudent> { :feelingForce (true) , :attitute ('good') , :laserSwordColor xsd:string , :numberLaserSwords xsd:nonNegativeInteger , !:mentorOf @<JediStudent> , :studentOf @<JediMentor> }
  24. 24. matching 'JediStudent' shape :Anakin :feelingForce true ; :attitute 'good' ; :laserSwordColor 'blue' ; :numberLaserSwords 1 ; :studentOf :Obi-Wan .
  25. 25. validation validator www.w3.org/2013/ShEx/FancyShExDemo executable examples R-52-NEGATIVE-OBJECT-PROPERTY-CONSTRAINTS
  26. 26. R-200-NEGATIVE-LITERAL- CONSTRAINTS ShEx, SPIN, SPARQL
  27. 27. constraint <Jedi> { :feelingForce (true) , :attitute ('good') , :laserSwordColor ('blue') , :numberLaserSwords (1) }
  28. 28. matching 'Jedi' shape :Joda :feelingForce true ; :attitute 'good' ; :laserSwordColor 'blue' ; :numberLaserSwords 1 .
  29. 29. constraint <Sith> { :feelingForce (true) , !:attitute ('good') , !:laserSwordColor ('blue') , :numberLaserSwords (2) }
  30. 30. matching 'Sith' shape :DarthSidious :feelingForce true ; :attitute 'evil' ; :laserSwordColor 'red' ; :numberLaserSwords 2 .
  31. 31. validation validator www.w3.org/2013/ShEx/FancyShExDemo executable examples R-200-NEGATIVE-LITERAL-CONSTRAINTS
  32. 32. validation and inferencing R-113-INTERACTION-OF-VALIDATION-WITH- REASONING R-198-RDF-VALIDATION-AFTER-INFERENCING OWL 2
  33. 33. R-63-TRANSITIVE-OBJECT-PROPERTIES (constraint) :ancestorOf a owl:TransitiveProperty .
  34. 34. R-63-TRANSITIVE-OBJECT-PROPERTIES (data) :Carter :ancestorOf :Lois . :Lois :ancestorOf :Meg . # :Carter # :ancestorOf :Meg . validation without inferencing constraint violation
  35. 35. R-63-TRANSITIVE-OBJECT-PROPERTIES (data) :Carter :ancestorOf :Lois ; a owl2spin:ToInfer . :Lois :ancestorOf :Meg . :Carter :ancestorOf :Meg . validation with inferencing NO constraint violation
  36. 36. validation validator purl.org/net/rdfval-demo executable examples R-63-TRANSITIVE-OBJECT-PROPERTIES
  37. 37. R-44-PATTERN-MATCHING-ON- RDF-LITERALS DQTP, OWL 2 DL, ReSh, ShEx, SPARQL, SPIN
  38. 38. valid data :TimBernersLee :hasSSN "123-45-6789"^^:SSN . invalid data :TimBernersLee :hasSSN "123456789"^^:SSN .
  39. 39. constraint :SSN a rdfs:Datatype ; owl:equivalentClass [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:pattern "[0-9]{3}-[0-9]{2}-[0-9]{4}" ] ) ] . :hasSSN rdfs:range :SSN .
  40. 40. validation validator purl.org/net/rdfval-demo executable examples R-44-PATTERN-MATCHING-ON-RDF-LITERALS
  41. 41. R-43-COMPARISONS-BASED- ON-DATATYPE DQTP, ShEx, SPARQL, SPIN
  42. 42. constraint SELECT ?s WHERE { ?s %%P1%% ?v1 . ?s %%P2%% ?v2 . FILTER ( ?v1 %%OP%% ?v2 ) }
  43. 43. test binding dbo:deathDate < dbo:birthDate P1 => dbo:deathDate P2 => dbo:birthDate OP => <
  44. 44. valid data :AlbertEinstein dbo:birthDate '1879-03-14'^^xsd:date ; dbo:deathDate '1955-04-18'^^xsd:date . invalid data :NeilArmstrong dbo:birthDate '2012-08-25'^^xsd:date ; dbo:deathDate '1930-08-05'^^xsd:date .
  45. 45. validation examples R-43-COMPARISONS-BASED-ON-DATATYPE
  46. 46. R-45-RANGES-OF-RDF-LITERAL- VALUES DQTP, OWL 2 DL, SPARQL, SPIN
  47. 47. constraint :NumberPlayersPerWorldCupTeam a rdfs:Datatype ; owl:equivalentClass [ a rdfs:Datatype ; owl:onDatatype xsd:nonNegativeInteger ; owl:withRestrictions ( [ xsd:minInclusive 1 ] [ xsd:maxInclusive 23 ] ) ] . :position rdfs:range :NumberPlayersPerWorldCupTeam .
  48. 48. valid data :MarioGoetze :position "19"^^:NumberPlayersPerWorldCupTeam . invalid data :MarioGoetze :position "99"^^:NumberPlayersPerWorldCupTeam .
  49. 49. validation validator purl.org/net/rdfval-demo examples R-45-RANGES-OF-RDF-LITERAL-VALUES
  50. 50. R-13-DISJOINT-GROUP-OF- PROPERTIES-CLASS-SPECIFIC ShEx, SPIN, SPARQL
  51. 51. constraint <Human> { ( foaf:name xsd:string | foaf:givenName xsd:string+ , foaf:familyName xsd:string ) }
  52. 52. matching 'Human' shape :Luke foaf:givenName "Luke" ; foaf:familyName "Skywalker" . ----- :Leia foaf:name "Leia Skywalker" .
  53. 53. NOT matching 'Human' shape :Anakin foaf:givenName "Anakin" ; foaf:familyName "Skywalker" ; foaf:name "Anakin Skywalker" .
  54. 54. validation validator www.w3.org/2013/ShEx/FancyShExDemo executable examples R-13-DISJOINT-GROUP-OF-PROPERTIES-CLASS- SPECIFIC

×