54
how to formulate and validate constraints?

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

Embed Size (px)

DESCRIPTION

How to Formulate and Validate Constraints (DC 2014)

Citation preview

  • 1. how to formulate andvalidate constraints?

2. R-28-OBJECT-PROPERTY-RANGEDSP, OWL 2, SPIN, SPARQL 3. valid data:myAddressa :PostalAddress ;:addressCountry :netherlands .:netherlands a :Country . 4. constraint (DSP):postalAddressa 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. invalid data:myAddressa :PostalAddress ;:addressCountry :amsterdam .:amsterdam a :Locality .-----:myAddressa :PostalAddress ;:addressCountry :amsterdam . 6. constraint (OWL2):addressCountrya owl:ObjectProperty ;rdfs:range :Country . 7. validationvalidatorpurl.org/net/rdfval-demoexecutable examplesR-28-OBJECT-PROPERTY-RANGE 8. R-68-REQUIRED-PROPERTIESBibframe, DQTP, DSP, OWL 2,ReSh, ShEx, SPIN, SPARQL 9. valid data:dcmia :Organization ;:name "Dublin Core Metadata Initiative" . 10. constraint (DSP):organizationDescriptionTemplatea 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. invalid data:dcmia :Organization . 12. constraint (OWL2):Organizationrdfs:subClassOf [a owl:Restriction ;owl:minCardinality 1 ;owl:onProperty :name ] . 13. validationvalidatorpurl.org/net/rdfval-demoexecutable examplesR-68-REQUIRED-PROPERTIES 14. R-38-DEFAULT-VALUES-OF-RDF-LITERALSSPIN, SPARQL 15. constraintowl:Thingspin:rule [a sp:Construct ;sp:text """CONSTRUCT {?this :laserSwordColor "blue" ;?this :numberLaserSwords 1 . }WHERE {?this a :Jedi . } """ ; ] . 16. data:Jodaa :Jedi , owl:Thing .inferred triples:Joda:laserSwordColor "blue" ;:numberLaserSwords 1. 17. constraintowl:Thingspin:rule [a sp:Construct ;sp:text """CONSTRUCT {?this :laserSwordColor red" ;?this :numberLaserSwords 2 . }WHERE {?this a :Sith . } """ ; ] . 18. data:DarthSidiousa :Sith , owl:Thing .inferred triples:DarthSidious:laserSwordColor red" ;:numberLaserSwords 2. 19. validationexamplesR-38-DEFAULT-VALUES-OF-RDF-LITERALS 20. R-52-NEGATIVE-OBJECT-PROPERTY-CONSTRAINTSShEx, SPIN, SPARQL 21. constraint {:feelingForce (true) ,:attitute xsd:string } {:feelingForce (true) ,:attitute ('good') ,:laserSwordColor xsd:string ,:numberLaserSwords xsd:nonNegativeInteger ,:mentorOf @ ,!:studentOf @ } 22. matching 'JediMentor' shape:Obi-Wan:feelingForce true ;:attitute 'good' ;:laserSwordColor 'blue' ;:numberLaserSwords 1 ;:mentorOf :Anakin . 23. constraint {:feelingForce (true) ,:attitute ('good') ,:laserSwordColor xsd:string ,:numberLaserSwords xsd:nonNegativeInteger ,!:mentorOf @ ,:studentOf @ } 24. matching 'JediStudent' shape:Anakin:feelingForce true ;:attitute 'good' ;:laserSwordColor 'blue' ;:numberLaserSwords 1 ;:studentOf :Obi-Wan . 25. validationvalidatorwww.w3.org/2013/ShEx/FancyShExDemoexecutable examplesR-52-NEGATIVE-OBJECT-PROPERTY-CONSTRAINTS 26. R-200-NEGATIVE-LITERAL-CONSTRAINTSShEx, SPIN, SPARQL 27. constraint {:feelingForce (true) ,:attitute ('good') ,:laserSwordColor ('blue') ,:numberLaserSwords (1) } 28. matching 'Jedi' shape:Joda:feelingForce true ;:attitute 'good' ;:laserSwordColor 'blue' ;:numberLaserSwords 1 . 29. constraint {:feelingForce (true) ,!:attitute ('good') ,!:laserSwordColor ('blue') ,:numberLaserSwords (2) } 30. matching 'Sith' shape:DarthSidious:feelingForce true ;:attitute 'evil' ;:laserSwordColor 'red' ;:numberLaserSwords 2 . 31. validationvalidatorwww.w3.org/2013/ShEx/FancyShExDemoexecutable examplesR-200-NEGATIVE-LITERAL-CONSTRAINTS 32. validation and inferencingR-113-INTERACTION-OF-VALIDATION-WITH-REASONINGR-198-RDF-VALIDATION-AFTER-INFERENCINGOWL 2 33. R-63-TRANSITIVE-OBJECT-PROPERTIES(constraint):ancestorOf a owl:TransitiveProperty . 34. R-63-TRANSITIVE-OBJECT-PROPERTIES(data):Carter:ancestorOf :Lois .:Lois:ancestorOf :Meg .# :Carter# :ancestorOf :Meg .validation without inferencingconstraint violation 35. R-63-TRANSITIVE-OBJECT-PROPERTIES(data):Carter:ancestorOf :Lois ;a owl2spin:ToInfer .:Lois:ancestorOf :Meg .:Carter:ancestorOf :Meg .validation with inferencingNO constraint violation 36. validationvalidatorpurl.org/net/rdfval-demoexecutable examplesR-63-TRANSITIVE-OBJECT-PROPERTIES 37. R-44-PATTERN-MATCHING-ON-RDF-LITERALSDQTP, OWL 2 DL, ReSh, ShEx,SPARQL, SPIN 38. valid data:TimBernersLee:hasSSN "123-45-6789"^^:SSN .invalid data:TimBernersLee:hasSSN "123456789"^^:SSN . 39. constraint:SSNa 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. validationvalidatorpurl.org/net/rdfval-demoexecutable examplesR-44-PATTERN-MATCHING-ON-RDF-LITERALS 41. R-43-COMPARISONS-BASED-ON-DATATYPEDQTP, ShEx, SPARQL, SPIN 42. constraintSELECT ?s WHERE {?s %%P1%% ?v1 .?s %%P2%% ?v2 .FILTER ( ?v1 %%OP%% ?v2 ) } 43. test bindingdbo:deathDate < dbo:birthDateP1 => dbo:deathDateP2 => dbo:birthDateOP => < 44. valid data:AlbertEinsteindbo:birthDate '1879-03-14'^^xsd:date ;dbo:deathDate '1955-04-18'^^xsd:date .invalid data:NeilArmstrongdbo:birthDate '2012-08-25'^^xsd:date ;dbo:deathDate '1930-08-05'^^xsd:date . 45. validationexamplesR-43-COMPARISONS-BASED-ON-DATATYPE 46. R-45-RANGES-OF-RDF-LITERAL-VALUESDQTP, OWL 2 DL, SPARQL, SPIN 47. constraint:NumberPlayersPerWorldCupTeama rdfs:Datatype ;owl:equivalentClass [a rdfs:Datatype ;owl:onDatatype xsd:nonNegativeInteger ;owl:withRestrictions ([ xsd:minInclusive 1 ][ xsd:maxInclusive 23 ] ) ] .:positionrdfs:range :NumberPlayersPerWorldCupTeam . 48. valid data:MarioGoetze:position "19"^^:NumberPlayersPerWorldCupTeam .invalid data:MarioGoetze:position "99"^^:NumberPlayersPerWorldCupTeam . 49. validationvalidatorpurl.org/net/rdfval-demoexamplesR-45-RANGES-OF-RDF-LITERAL-VALUES 50. R-13-DISJOINT-GROUP-OF-PROPERTIES-CLASS-SPECIFICShEx, SPIN, SPARQL 51. constraint {(foaf:name xsd:string|foaf:givenName xsd:string+ ,foaf:familyName xsd:string)} 52. matching 'Human' shape:Lukefoaf:givenName "Luke" ;foaf:familyName "Skywalker" .-----:Leiafoaf:name "Leia Skywalker" . 53. NOT matching 'Human' shape:Anakinfoaf:givenName "Anakin" ;foaf:familyName "Skywalker" ;foaf:name "Anakin Skywalker" . 54. validationvalidatorwww.w3.org/2013/ShEx/FancyShExDemoexecutable examplesR-13-DISJOINT-GROUP-OF-PROPERTIES-CLASS-SPECIFIC