# ML Wiki

## 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
CONSTRUCT { ?y ?q ?x }
WHERE {
?p owl:inverseOf ?q .
?x ?p ?y .
}


Example:

• lit:Shakespeare lit:wrote lit:Macbeth
• we know that lit:wrote owl:inverseOf lit:writtenBy
• so, can infer that lit:Macbeth lit:writtenBy lit:Shakespeare

### owl:SymmetricProperty: 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: bio:Anne bio:married lit:Shakespeare
• consider this query
• SELECT ?who WHERE { ?lit:Shakespeare bio:married ?who }
• now state that married is both-way: it's inverse of itself
• bio:married owl:inverseOf bio:married
• now that query returns something
• this is an example of a owl:SymmetricProperty
• so instead of owl:inverseOf can say
• bio:married rdf:type owl:SymmetricType
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:

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

### owl:equivalentClass: 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:
• :A rdfs:subClassOf :B $\land$ :B rdfs:subClassOf :A
• semantically same effect is achieved with owl:equivalentClass
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:

-- 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:
• owl:sameAs rdf:type owl:SymmetricProperty

## Sameness: Functional Properties

### owl:FucntionalProperty

Functional - of functions (in math)

• a property is functional if
• for some input value there could be only one output value

Examples (from RL):

• hasMother - can have only one biological mother
• hasBirthplace
• birthdate

In RDFS-plus use owl:FucntionalProperty to describe that

• a property can give only one value for one particular entry
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 .