ML Wiki
Machine Learning Wiki - A collection of ML concepts, algorithms, and resources.

RDFS-Plus

RDFS-Plus

In Semantic Web RDFS-Plus is an extension of RDFS, and a subset of OWL

  • even though the namespace is OWL, it’s considered as a subset
  • Inference rules are shown with SPARQL CONSTRUCT queries
  • for logical semantics behind there expressions see Semantic Web Logic
  • DL-Lite something

Basic Constructs

owl:inverseOf: Inverse

Example

  • suppose we have :hasParent - then the inverse is :hasChild
  • the construction owl:inverseOf makes this relation explicit

In math,

  • inverse of $f$ is $f^{-1}$:
  • if $f(x) = y$, then $f^{-1}(y) = x$
  • the same idea is in RDFS-Plus

```text only CONSTRUCT { ?y ?q ?x } WHERE { ?p owl:inverseOf ?q . ?x ?p ?y . }



Example:
- <code>lit:Shakespeare lit:wrote lit:Macbeth </code>
- we know that <code>lit:wrote owl:inverseOf lit:writtenBy</code>
- so, can infer that <code>lit:Macbeth lit:writtenBy lit:Shakespeare</code>


### <code>owl:SymmetricProperty</code>: Symmetric Properties
- in real life, a relation "married" is both-way: 
  - if $A$ is married on $B$, then $B$ is married on $A$
- suppose we have this assertion: <code>bio:Anne bio:married lit:Shakespeare</code>
- consider this query
  - <code>SELECT ?who WHERE { ?lit:Shakespeare bio:married ?who }</code>
  - it returns no answer|    |- now state that married is both-way: it's inverse of itself |  - <code>bio:married owl:inverseOf bio:married</code>
  - now that query returns something 
- this is an example of a <code>owl:SymmetricProperty</code>
  - so instead of <code>owl:inverseOf</code> can say
  - <code>bio:married rdf:type owl:SymmetricType</code>

```text only
CONSTRUCT { ?p owl:inverseOf ?p. } 
WHERE { ?p a owl:SymmetricProperty . }

Also, can be useful to say that owl:inverseOf is symmetric

  • owl:inverseOf rdf:type owl:SymmetricProperty
  • now the following hold:
    • $:P_1$ owl:inverseOf $:P_2 \Rightarrow$
    • $:P_2$ owl:inverseOf $:P_1$

owl:TransitiveProperty: Transitivity

In math:

  • $R$ is transitive if
  • $a \ R \ b \land b \ R \ c \Rightarrow a \ R \ c$

In RDFS-plus, owl:TransitiveProperty is used for that:

  • :P rdf:type owl:TransitiveProperty

Meaning: ```text only CONSTRUCT { ?x ?p ?z .} WHERE { ?x ?p ?y . ?y ?p ?x . ?p a owl:TransitiveProperty . }


Note that for longer chains like $a \to b \to ... \to q$ the rule also holds


### <code>owl:equivalentClass</code>: Equivalence
Identity
- URIs give the global notion of identity
- but what if we merging two different sources that have the same concept, but under different URIs? 
- i.e. we want to say that $:A \equiv :B$
- use [RDFS](RDFS):
  - <code>:A rdfs:subClassOf :B</code> $\land$ <code>:B rdfs:subClassOf :A</code>
- semantically same effect is achieved with <code>owl:equivalentClass</code>

```carbon
CONSTRUCT { ?r rdf:type ?b .} 
WHERE { 
  ?a owl:equivalentClass ?b . 
  ?r rdf:type ?a . 
}

CONSTRUCT { ?r rdf:type ?a .} 
WHERE { 
  ?a owl:equivalentClass ?b . 
  ?r rdf:type ?b . 
}

Note that we need to have 2 CONSTRUCT statements

  • because owl:equivalentClass is symmetric
  • but instead of repeating twice can say that
    • owl:equivalentClass rdf:type owl:SymmetricProperty
  • can add the following and have no need to state anything
    • owl:equivalentClass rdfs:subPropertyOf rdfs:subClassOf

owl:sameAs: Same Individuals

Suppose in 3 namespaces we have 3 different ways of describing a person

  • how we can say that in all these 3 cases something/somebody is the same resource?
  • e.g. pr:WilliamShakspere owl:sameAs lit:Shakespeare

it’s defined by 3 rules: ```text only – when it’s a subject CONSTRUCT { ?s ?p ?x. } WHERE { ?s ?p ?y. ?x owl:sameAs ?y . }

– when it’s an object CONSTRUCT { ?x ?p ?o. } WHERE { ?y ?p ?o . ?x owl:sameAs ?y . }

– when it’s a predicate CONSTRUCT {?s ?x ?o. } WHERE { ?s ?y ?o . ?x owl:sameAs ?y . }


To avoid adding 3 more rules
- say that it's symmetric:
- <code>owl:sameAs rdf:type owl:SymmetricProperty</code>


## Sameness: Functional Properties
### <code>owl:FucntionalProperty</code>
Functional - of functions (in math)
- a property is functional if
- for some input value there could be only one output value

Examples (from RL):
- <code>hasMother</code> - can have only one biological mother
- <code>hasBirthplace</code> 
- <code>birthdate</code>

In RDFS-plus use <code>owl:FucntionalProperty</code> to describe that
- a property can give only one value for one particular entry
```carbon
CONSTRUCT { ?a owl:sameAs ?b . } 
WHERE {
  ?p rdf:type owl:FunctionalProperty .
  ?x ?p ?a . 
  ?x ?p ?b . 
}

Note the semantics

  • if $x^2 = a \land x^2 = b \Rightarrow a = b$
  • so if some resources participate in a functional property
  • we conclude that these resources refer to the same entity (i.e. they are the same)

owl:InverseFunctionalProperty

Inverse of owl:FucntionalProperty

  • a single value of an inverse functional property cannot be shared by two entities
  • instead it infers that these two entities are the same
  • and it doesn’t signalize any errors| |- examples: SSN, driver license, etc - anything that can be an ID number |
    CONSTRUCT { ?a owl:sameAs ?b . } 
    WHERE {
    ?p rdf:type owl:InverseFunctionalProperty .
    ?a ?p ?x . 
    ?b ?p ?x . 
    }
    

Examples

Student ID

  • a student has an identity
  • this ID # belongs only to one person
  • so have this in the schema
    • :hasIdentityNo rdfs:domain :Student .
    • :hasIdentityNo rdfs:range xsd:Integer .
  • now ensure the uniqueness
    • :hasIdentityNo rdf:type owl:FunctionalProperty .
    • :hasIdentityNo rdf:type owl:InverseFunctionalProperty .

Summary

Functional Only

  • hasMotheris a functional property only.
  • Someone has exactly one mother, but many people can share the same mother.

Inverse Functional Only

  • hasDiary is an inverse functional property only
  • A person may have many diaries, but a diary is authored by one person only

Both Functional and Inverse Functional

  • SSN, Student #, etc

Other Constructs

owl:DatatypeProperty and owl:ObjectPropery

In RDF, subjects and objects are resource

  • they can be either another resources or some data items

Examples:

  • uni:studentId a owl:DatatypeProperty
  • bio:married a owl:ObjectProperty

owl:Class

owl:Class rdfs:subClassOf rdfs:Class .

See Also

Sources