ldom:property

advertisement
LDOM (Linked Data Object Model)
Motivation & Overview for Shapes WG
Holger Knublauch
2015-01-22
Motivation
• LDOM is the result of discussions in Shapes WG
and the previous mailing list
• Attempts to cover the essential features of the
input languages SPIN & Resource Shapes/ShEx
• Evolutionary compatibility with RDFS/OWL
• Covers all requirements in our current catalogue
• Goal: A starting point to work out details
• Feedback so far has been very positive
Naming
• Finding the perfect name is difficult
• A name also signals community outreach
• Messages
– “Linked Data”
– “Schema/Specification/Shape Language”
– “Web Objects” or “OO for the Web”
– “Schema language for JSON-LD”
• LDOS (Linked Data Object Shapes) would be OK
Example
width and height
must be > 0
area :=
width x height
width and height
must be equal
ex:Rectangle
width: integer[1..1]
height: integer[1..1]
area: integer[0..1]
ex:Square
schema:Person
ex:creator
0..1
0..*
Class Definitions
ex:Rectangle
a rdfs:Class ;
rdfs:subClassOf rdfs:Resource ;
rdfs:label "Rectangle" .
ex:Square
a rdfs:Class ;
rdfs:subClassOf ex:Rectangle ;
rdfs:label "Square" .
• Just like in RDF Schema or OWL
• People can reuse/extend existing ontologies
• Only relies on a small subset of RDFS:
(rdf:type, rdfs:Class, rdfs:subClassOf)
Property Declarations
• Similar to object-oriented attributes/relations
ex:Rectangle
a rdfs:Class ;
rdfs:subClassOf rdfs:Resource ;
rdfs:label "Rectangle" ;
ldom:property [
a ldom:PropertyConstraint ; # Optional
ldom:predicate ex:height ;
ldom:minCount 1 ;
ldom:maxCount 1 ;
ldom:valueType xsd:integer ;
rdfs:label "height" ;
rdfs:comment "The height of the Rectangle." ;
] ; ...
Possible JSON-LD Syntax
{
"@id" : "ex:Rectangle",
"@type" : "Class",
"subClassOf" : "rdfs:Resource",
"label" : "Rectangle",
"property" : [
{
"predicate" : "ex:height",
"minCount" : 1,
"maxCount" : 1,
"valueType" : "xsd:integer",
"label" : "height",
"comment" : "The height of the Rectangle."
},
...
]
}
SPARQL Constraints
ex:Square
a rdfs:Class ;
rdfs:label "Square" ;
rdfs:subClassOf ex:Rectangle ;
ldom:constraint [
ldom:message "Width and height of a Square
must be equal" ;
ldom:path ex:width ;
ldom:path ex:height ;
ldom:sparql """
ASK {
?this ex:width ?width .
?this ex:height ?height .
FILTER (?width != ?height) .
}
""" ;
] .
Templates and Functions
• Encapsulate reusable SPARQL logic
• Define simpler, high-level languages
• LDOM itself uses templates
(e.g. ldom:minCount is based on SPARQL)
• Side-effect: Language is self-contained
• Language is extensible (based on Linked Data)
Template-Based Constraints
ex:Rectangle
# Each Rectangle must have a creator that has
# an email address
ldom:constraint [
a ldom:ShapeConstraint ;
ldom:predicate ex:creator ;
ldom:some [
ldom:property [
ldom:predicate schema:email ;
ldom:minCount 1 ;
] ;
] ;
] ;
Recursive shapes like in
Resource Shapes / ShEx
Other Features
•
•
•
•
•
•
•
•
Datatype constraint declarations
Default values, enumerations
Inverse and derived properties
Static (global) constraints
Graph management (includes etc)
Built-in SPARQL functions
Test Case vocabulary
Rules (perhaps a separate deliverable)
Download