RDFS
Is a schema language for RDF
- roughly, RDF is for defining graphs, RDFS - for defining sets
- RDFS tells how to use the graph structure - gives some semantics to the used vocabulary
- how items and their properties are related
- also provides some basic inferencing capabilities (for Knowledge Discovery)
- Inference rules are nice to show with SPARQL CONSTRUCT queries
- RDFS statements can be interpreted as FOL statements
- for logical semantics behind there expressions see Semantic Web Logic
- RDFS is expressed using RDF triples
RDFS “extends” RDF
- in the sense that it gives some meaning to the triples
Basic Constructs
rdfs:Class
A set is identified in RDFS with rdfs:Class
- note the use of
rdfs:
namespace
:AllStarPlayer rdf:type rdfs:Class.
:MajorLeaguePlayer rdf:type rdfs:Class.
:Surgeon rdf:type rdfs:Class.
:Staff rdf:type rdfs:Class.
:Physician rdf:type rdfs-subproperty:Class.
rdfs:subClassOf
Suppose we have the following assertions
:Apple rdfs:subClassOf :Fruit
:RedDelicions a :Apple
- can infer that
:RedDelicions a :Fruit
The inference rule is
CONSTRUCT { ?r rdf:type ?B }
WHERE {
?A rdfs:subClassOf ?B .
?r rdf:type ?A
}
rdfs:subPropertyOf
Example:
- relation “brother” is more specific than “sibling”
- if smb is my brother, he also is my sibling
- so
:brother rdfs:subPropertyOf :sibling
The inference rule is ```text only CONSTRUCT { ?x ?r ?y } WHERE { ?x ?q ?y . ?q rdfs:subPropertyOf ?r }
Another example
- <img src="https://raw.githubusercontent.com/alexeygrigorev/wiki-figures/master/ufrt/xml/sw/rdfs-subproperty.png" alt="Image">
### <code>rdfs:domain</code> and <code>rdfs:range</code>
Typing data by usage (also - ''implicit'' typing)
- as opposed to the ''explicit'' typing <code>rdf:type</code>
- <code>rdfs:domain</code> - set of values for which a property is defined (subject)
- <code>rdfs:range</code> - set of values it can take (object)
Can define them as
```carbon
CONSTRUCT {?y rdf:type ?D .}
WHERE {
?P rdfs:range ?D .
?x ?P ?y .
}
CONSTRUCT {?x rdf:type ?D .}
WHERE {
?P rdfs:domain ?D .
?x ?P ?y .
}
’'’NB’’’:
- there’s no notion of incorrect/inconsistent inference in RDFS
- it doesn’t signalize an error if a property isn’t used consistently with the declaration
- RDFS will infer the type to make this property consistent
- this declaration is quite aggressive - even with one triple it can result in surprising inferences
Example
Suppose we have the following schema
:MarriedWoman rdfs:subClassOf :Woman.
:hasMaidenName rdfs:domain :MarriedWoman.
And the following assertions:
:Karen :hasMaidenName "Stephens".
Inference:
- Even if we don’t know that
:Karen
is a:Woman
, we can infer that she’s married - infer that
:Karen rdf:type :MarriedWoman
based onrdfs:domain
- infer that
:Karen rdf:type :Woman
based onrdfs:subClassOf
Modeling with RDFS
There are some basic modeling patterns that can be used in RDFS
Intersection
$C \equiv A \cap B$
:C rdfs:subClassOf :A
:C rdfs:subClassOf :B
- need to be a subclass of both $A$ and $B$ to be in $C$
Union
$C \equiv A \cup B$
:A rdfs:subClassOf :C
:B rdfs:subClassOf :C
- $x \in C$ when $x$ is a subclass of $A$, or subclass of $B$ (or both)
Properties
Intersection and Union can also be used for properties, e.g.
- Intersection
:R rdfs:subPropertyOf :P .
:R rdfs:subPropertyOf :Q .
- Union
:P rdfs:subPropertyOf :R .
:Q rdfs:subPropertyOf :R .
Example: ‘‘Terminology reconciliation’’
- A military plane needs to determine if it can attach something or not
- it has 2 sources of data
- “never-target” list: schools, churches, hospitals
- “off-limit airspace”: no-fly zones
- a target is off-limit if it belongs to one of these classes
- solution: use union
fc:Civilian rdfs:subClassOf cc:OffLimitTarget
space:NoFlyZone rdfs:subClassOf cc:OffLimitTarget
Example 2: Property union
- if
:A rdfs:label "something"
, then “something” is a printable name of:A
- it’s more readable than URIs
- but suppose that in our data source we don’t have it, but have something else with some textual information
:person1 :personName "James Dean"
:movie1 :movieTitle "Giant"
- we want to use these properties as labels
- solution: use property union:
:personName rdfs:subPropertyOf rdfs:label
:movieTitle rdfs:subPropertyOf rdfs:label
Non-modeling Properties in RDFS
There are properties that aren’t used for inference, but just for description
rdfs:label
- text representationrdfs:seeAlso
- cross referencingrdfs:isDefinedBy
- primary source/description of a resourcerdfs:comment
- a comment
See Also
- RDFS and OWL summary
- Semantic Web
- Inference in Semantic Web
- RDFS-Plus - a subset of OWL and an extension of RDFS with more inferencing capabilities
- OWL
- Semantic Web Logics