Skip to content

KnowledgeBase modeling example

pboisver edited this page Feb 17, 2025 · 8 revisions

KnowledgeBase modeling example

The owl example expresses roughly this:

  • A koio:KnowledgeBase is a koio:KnowledgeObject
  • A koio:KnowledgeBase is a container (rdfs:Container; a simple readily available collection model )
  • koio:KnowledgeBase members must be KnowledgeObjects (rdfs:member is the generic container membership property with domain and range rdfs:Resource)
  • It must have a koio:designPurpose property, which describes some unifying principle, intention, or relationship between the members (currently modeled as a owl:DatatypeProperty)
  • koio:hasService and koio:hasKnowledge properties can be used at the knowledge base level as a way to point to relevant koio:Knowledge and/or koio:Services that are common to some subsets of the member KOs.

A knowledge base is a collection of objects of some sort. What distinguishes it from a simple collection is:

a) it is itself a knowledge object

b) its members are knowledge objects

b) it has a design purpose (organizing principle, common computational goal, driving use case, etc.) which is distinct from the purpose of its contained members. The design purpose is expressed through:

  1. the design purpose property (koio:designPurpose)
  2. the koio:hasKnowledge and koio:hasService inherited from the knowledge object class
  3. the container membership property (rdfs:member, or a more specific property relevant to this knowledge base)

Notes:

  • THe important properties inhere=ited by KnowledgeBase from KnowledgeObject are koio:designPurpose (required), koio:hasService (optional), and koio:hasKnowledge (required)

  • 'koio:designPurpose' might work as an owl:ObjectProperty or might be worth reifying as a class, koio:DesignPurpose, which can have multiple properties and types.

  • The design purpose property (or class) might also be relevant for KOs

  • The container membership could be enriched by specifying an rdfs:ContainerMembershipProperty like, say, koio:hasKnowledgeObject. This encodes the domain in the property name, but there could be other useful semantic enhancements. Alternatively, particular knowledge bases are free to create their own rdfs:ContainerMembershipProperty which might expressa relevant design relationship.

  • koio:KnowledgeBase subclasses rdfs:Container but could subclass a more specific container—rdfs:Bag, rdfs:Seq, rdfs:Alt

  • At the knowledgebase level, koio:hasService and koio:hasKnowledge properties would presumably be relevant to the koio:designPurpose. This is one way to express the CBK-relevant relationship between the parts and the whole:

    This knowledge base brings together 14 cancer risk models (koio:Knowledge) accessed by providing a defined patient feature set and returning a 10-year risk probability (koio:Service). A panel service (also koio:Service) is included with the knowledge base to access and aggregate the results.

  • I think we ought to reject the notion that the organizing principle that distinguishes a knowledge base from a collection of knowledge objects is its computational purpose. That may be part of it, but consider: a knowledge base itself is a knowledge object, therefore what distinguishes it from a simple collection (or any plain old computational thing!) is that it contains knowledge and means to access that knowledge.

    Most importantly, it contains knowledge and the means to access that knowledge that is greater than the sum of its parts. This greater than piece is the design purpose! If it did not have this extra secret sauce, it would be just a collection.

    A knowledge base is a collection and a knowledge object

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:koio="http://example.com/koio#">

    <owl:Class rdf:about="http://example.com/koio#KnowledgeBase">
        <rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Container"/>
        <rdfs:subClassOf rdf:resource="http://example.com/koio#KnowledgeObject"/> 
        <rdfs:comment>A container for Knowledge Objects, which is itself also a KnowledgeObject.</rdfs:comment>
        <rdfs:label>Knowledge Base</rdfs:label>

        <owl:equivalentClass>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#_member"/>
                <owl:allValuesFrom rdf:resource="http://example.com/koio#KnowledgeObject"/>
            </owl:Restriction>
        </owl:equivalentClass>

        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://example.com/koio#designPurpose"/>
                <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</owl:minCardinality>
            </owl:Restriction>
        </rdfs:subClassOf>

    </owl:Class>

    <owl:Class rdf:about="http://example.com/koio#KnowledgeObject">
        <rdfs:label>Knowledge Object</rdfs:label>
        <rdfs:comment>A unit of knowledge within the Knowledge Base.</rdfs:comment>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://example.com/koio#hasKnowledge"/>
                <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</owl:minCardinality>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>

    <owl:Class rdf:about="http://example.com/koio#Service">
        <rdfs:label>Service</rdfs:label>
    </owl:Class>

    <owl:Class rdf:about="http://example.com/koio#Knowledge">
        <rdfs:label>Knowledge</rdfs:label>
    </owl:Class>


    <owl:DatatypeProperty rdf:about="http://example.com/koio#designPurpose">
        <rdfs:label>Design Purpose</rdfs:label>
        <rdfs:domain rdf:resource="http://example.com/koio#KnowledgeBase"/>
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    </owl:DatatypeProperty>

    <owl:ObjectProperty rdf:about="http://example.com/koio#hasService">
        <rdfs:label>Has Service</rdfs:label>
        <rdfs:domain rdf:resource="http://example.com/koio#KnowledgeBase"/>
        <rdfs:domain rdf:resource="http://example.com/koio#KnowledgeObject"/>
        <rdfs:range rdf:resource="http://example.com/koio#Service"/>
    </owl:ObjectProperty>

    <owl:ObjectProperty rdf:about="http://example.com/koio#hasKnowledge">
        <rdfs:label>Has Knowledge</rdfs:label>
        <rdfs:domain rdf:resource="http://example.com/koio#KnowledgeBase"/>
        <rdfs:domain rdf:resource="http://example.com/koio#KnowledgeObject"/>
        <rdfs:range rdf:resource="http://example.com/koio#Knowledge"/>
    </owl:ObjectProperty>

</rdf:RDF>

A second example

Here's another example that uses an rdfs:ContainerMembershipProperty to restrict the types of objects in a knowledge base; it also adds the requirement that there be at least one member KnowledgeObject. This example adds the designPurpose property to the KnowledgeObject, allowing the KnowledgeBase subclass to inherit that property. The KnowledgeBase class further restricts the designPurpose to be required. KnowledgeBase class inherits the hasKnowledge requirement from the KnowledgeObject as well:

<?xml version="1.0"?>
<owl:Ontology xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:koio="http://example.org/koio#"
     xml:lang="en"
     ontologyIRI="http://example.org/koio/koio.owl">


<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
 -->


<owl:Class rdf:ID="KnowledgeBase">
    <rdfs:label xml:lang="en">Knowledge Base</rdfs:label>
    <rdfs:comment xml:lang="en">A collection of Knowledge Objects with a unifying design purpose.</rdfs:comment>
    <rdfs:subClassOf rdfs:Container"/>
    <rdfs:subClassOf rdf:resource="#KnowledgeObject"/>
    <owl:equivalentClass>
        <owl:Class>
            <owl:intersectionOf rdf:parseType="Collection">
                <rdf:Description rdf:about="#KnowledgeObject"/>
                <rdf:Description rdfs:Container"/>
                <owl:Restriction>
                    <owl:onProperty rdf:resource="#designPurpose"/>
                    <owl:minCardinality rdf:datatype="xsd:nonNegativeInteger">1</owl:minCardinality>
                </owl:Restriction>
                <owl:Restriction>
                    <owl:onProperty rdf:resource="#hasKnowledgeObject"/>
                    <owl:minCardinality rdf:datatype="xsd:nonNegativeInteger">1</owl:minCardinality>
                </owl:Restriction>
            </owl:intersectionOf>
        </owl:Class>
    </owl:equivalentClass>
</owl:Class>


<owl:Class rdf:ID="KnowledgeObject">
    <rdfs:label xml:lang="en">Knowledge Object</rdfs:label>
    <rdfs:comment xml:lang="en">A generic class for knowledge objects.</rdfs:comment>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="#hasKnowledge"/>
            <owl:minCardinality rdf:datatype="xsd:nonNegativeInteger">1</owl:minCardinality>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>
<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->


<owl:ObjectProperty rdf:ID="hasKnowledgeObject">
    <rdfs:label xml:lang="en">has Knowledge Object</rdfs:label>
    <rdfs:comment xml:lang="en">Relates a Knowledge Base to its member Knowledge Objects.</rdfs:comment>
    <rdfs:domain rdf:resource="#KnowledgeBase"/>
    <rdfs:range rdf:resource="#KnowledgeObject"/>
    <rdf:type rdfs:ContainerMembershipProperty"/>
</owl:ObjectProperty>


<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Datatype Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->


<owl:DatatypeProperty rdf:ID="designPurpose">
    <rdfs:label xml:lang="en">design purpose</rdfs:label>
    <rdfs:comment xml:lang="en">Describes the unifying design purpose of a Knowledge Object.</rdfs:comment>
    <rdfs:domain rdf:resource="#KnowledgeObject"/>
    <rdfs:range xsd:string"/>
</owl:DatatypeProperty>


<owl:DatatypeProperty rdf:ID="hasService">
    <rdfs:label xml:lang="en">has service</rdfs:label>
    <rdfs:comment xml:lang="en">Relates a Knowledge Object to a service.</rdfs:comment>
    <rdfs:domain rdf:resource="#KnowledgeObject"/>
    <rdfs:range xsd:string"/>
</owl:DatatypeProperty>


<owl:DatatypeProperty rdf:ID="hasKnowledge">
    <rdfs:label xml:lang="en">has knowledge</rdfs:label>
    <rdfs:comment xml:lang="en">Relates a Knowledge Object to some knowledge.</rdfs:comment>
    <rdfs:domain rdf:resource="#KnowledgeObject"/>
    <rdfs:range xsd:string"/>
</owl:DatatypeProperty>

</owl:Ontology>

Modeling the KnowledgeBase as a KnowledgeObject when collections of KnowledgeObjects are also KnowledgeObjects

:KwObject owl:unionOf (
    :KwObject  # KwObject is either an individual or...
    [
      a owl:Class ;
      owl:intersectionOf (
        rdf:Bag ; # ...a Bag...
        [
          a owl:Restriction ;
          owl:onProperty :hasKwObject ;
          owl:allValuesFrom :KwObject # ...where ALL values of hasKwObject are KwObjects
        ]
      )
    ]
  ) .

:hasKwObject a owl:ObjectProperty .

:KwBase rdfs:subClassOf :KwObject ;  # KwBase is a subtype of KwObject
  owl:intersectionOf (
    rdf:Bag ;                     # KwBase MUST be a collection (Bag)
    [
      a owl:Restriction ;
      owl:onProperty :hasKwObject ;
      owl:allValuesFrom :KwObject  # All members of the collection must be KwObjects
    ] ;
    [
      a owl:Restriction ;          # KwBase MUST have the :hasPurpose property
      owl:onProperty :hasPurpose ;
      owl:minCardinality "1"^^xsd:integer # At least one value for hasPurpose
    ]
  ) .

:hasPurpose a owl:ObjectProperty . # hasPurpose is an object property