JohnG79
JohnG79

Reputation: 1595

Description Logics and Ontologies: How to denote role domain-restrictions to blank nodes

Request for assistance denoting a domain-restriction to a blank node. Modelling a Many-to-Many (Relational) Table with a Blank Node Figure 1: Modelling a many-to-many relationship with a blank node.

Business Rule: An Enrolment maps one Student to one Section, once.

My attempt:

∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤ 

i.e. "the set of individuals that have some value for the role 'hasStudent' is the same set of individuals that have some value for the role 'hasSection' ...e.t.c."

I assume equivalence here instead of inclusion since the inclusions would be in both directions.

Restricting further:

∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤ ≡ =1hasStudent.⊤ ≡ =1hasSection.⊤ ≡ =1grade_code.⊤

i.e. "the set of individuals that have values for the roles 'hasStudent', 'hasSection' and 'grade_code', have one and only one value for them."

Assistance or comments on correctly denoting the domain-restrictions of the object properties in figure 1 would be appreciated.

Thanks!!

Upvotes: 0

Views: 180

Answers (2)

scotthenninger
scotthenninger

Reputation: 4001

OWL's Open World assumption is going to prevent you from finding "the set of individuals that have values for the roles 'hasStudent', 'hasSection' and 'grade_code', have one and only one value for them."

However, using SPARQL, you could create an ASK query that does just what you are asking for:

ASK {
   SELECT (count(?student) AS ?stcount) (count(?section) AS ?secount) (count(?course) AS ?ccount)
   WHERE {
      ?indiv :hasStudent ?student .
      ?indiv :hasSection ?section .
      ?indiv :grade_course ?course .
   } GROUP BY ?student ?section ?course
   HAVING (stcount = 1 && ?secount = 1 && ?ccount = 1)
}

A bit akward syntactically, since the aggregates need to be computed by a SELECT statement. The ASK will return true if the 'constraints' (see the HAVING clause) are all true and false otherwise.

For future reference the SHACL (RDF Shapes Constraint Language) work at W3C is intended to shore up these kinds of constraint violation problems that are not possible to answer with OWL.

Upvotes: 2

Ignazio
Ignazio

Reputation: 10659

If I understand your intent correctly, you want these restrictions to apply to any use of these properties rather than only for a specific class.

Under this assumption, you can achieve this by declaring the properties functional and setting their domain to C. In Functional syntax:

Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)

Ontology(
Declaration(Class(<urn:test:C>))
Declaration(ObjectProperty(<urn:test:hasSection>))
Declaration(ObjectProperty(<urn:test:hasStudent>))
Declaration(DataProperty(<urn:test:grade_code>))

FunctionalObjectProperty(<urn:test:hasSection>)
ObjectPropertyDomain(<urn:test:hasSection> <urn:test:C>)

FunctionalObjectProperty(<urn:test:hasStudent>)
ObjectPropertyDomain(<urn:test:hasStudent> <urn:test:C>)

FunctionalDataProperty(<urn:test:grade_code>)
DataPropertyDomain(<urn:test:grade_code> <urn:test:C>)

SubClassOf(<urn:test:C> ObjectIntersectionOf(ObjectSomeValuesFrom(<urn:test:hasSection> owl:Thing) ObjectSomeValuesFrom(<urn:test:hasStudent> owl:Thing) DataSomeValuesFrom(<urn:test:grade_code> rdfs:Literal)))
)

Upvotes: 1

Related Questions