420 likes | 589 Views
Meta-Circularity and MOP in Common Lisp for OWL Full. Seiji Koide The Graduate Univ. Advanced Studies (SOKENDAI) Hideaki Takeda National Institute of Informatics and SOKENDAI. Computer Language Semantics. Procedural Semantics Denotational Semantics Axiomatic Semantics.
E N D
Meta-Circularity and MOP in Common Lisp for OWL Full Seiji Koide The Graduate Univ. Advanced Studies (SOKENDAI) Hideaki Takeda National Institute of Informatics and SOKENDAI
Computer Language Semantics • Procedural Semantics • Denotational Semantics • Axiomatic Semantics
Denotational Semantics in CLOS (defpackage :a (:export "Dog""Brian""Species")) (defparameter a:Species (defclass a:Species (cl:standard-class) () (:metaclass cl:standard-class))) (defparameter a:Dog (defclass a:Dog () () (:metaclass a:Species))) (defparameter a:Brian (make-instance 'a:Dog)) Brian Dog Species #<Species Dog> #<standard-class Species> #<a:Dog @ #x20ff6742> World Brian a dog a species
Denotational Semantics in CLOS (defpackage :a (:export "Dog""Brian""Species")) (defparameter a:Species (defclass a:Species (cl:standard-class) () (:metaclass cl:standard-class))) (defparameter a:Dog (defclass a:Dog () () (:metaclass a:Species))) (defparameter a:Brian (make-instance 'a:Dog)) Brian Dog Species #<Species Dog> #<standard-class Species> #<a:Dog @ #x20ff6742> World BrianI DogI SpeciesI
Extensional Semantics in CLOS standard-classI ∈ CEXTI (standard-classI) standard-classI ∈ standard-classI Species #<standard-class standard-class> #<standard-class Species> Dog #<standard-class standard-object> #<Species Dog> BrianI ∈ CEXTI (DogI) DogI ∈ CEXTI (SpeciesI) SpeciesI ∈ CEXTI (standard-classI) Brian #<a:Dog @ #x20ff6742> World BrianI DogI SpeciesI
Meta-Circularity of rdfs:Class • Axiom1: Every class that is an instance of rdfs:ClassI is a subclass of rdfs:ResourceI. • x∈CI=CEXTI(rdfs:ClassI) ⇒ x ⊑ rdfs:ResourceI • Axiom 2: Any class in super-subclass relation is an instance of rdfs:ClassI. • x ⊑ y ⇒ x ∈CI⋀ y ∈CI • Axiom 3: rdfs:ClassI is a subclass of rdfs:ResourceI . • rdfs:ClassI⊑ rdfs:ResourceI ⇒ rdfs:ClassI∈CI ⇒ rdfs:ResourceI∈CI
Meta-Circularity of rdfs:Class • Axiom1: Every class that is an instance of rdfs:ClassI is a subclass of rdfs:ResourceI. • x∈CI=CEXTI(rdfs:ClassI) ⇒ x ⊑ rdfs:ResourceI • Axiom 2: Any class in super-subclass relation is an instance of rdfs:ClassI. • x ⊑ y ⇒ x ∈CI⋀ y ∈CI • Axiom 3: rdfs:ClassI is a subclass of rdfs:ResourceI . • rdfs:ClassI⊑ rdfs:ResourceI Meta-Circularity ⇒ rdfs:ClassI∈CEXTI(rdfs:Class ⇒ rdfs:ResourceI∈CEXTI(rdf ⇒ rdfs:ResourceI⊑rdfs:ResourceI
Meta-Circularity of rdfs:Class • Axiom1: Every class that is an instance of rdfs:ClassI is a subclass of rdfs:ResourceI. • x∈CI=CEXTI(rdfs:ClassI) ⇒ x ⊑ rdfs:ResourceI • Axiom 2: Any class in super-subclass relation is an instance of rdfs:ClassI. • x ⊑ y ⇒ x ∈CI⋀ y ∈CI • Axiom 3: rdfs:ClassI is a subclass of rdfs:ResourceI . • rdfs:ClassI⊑ rdfs:ResourceI ⇒ rdfs:ClassI∈CEXTI(rdfs:Class ⇒ rdfs:ResourceI∈CEXTI(rdf ⇒ rdfs:ResourceI⊑rdfs:ResourceI
Twist Relation of rdfs:Resource and rdfs:Class • rdfs:ClassI⊑ rdfs:ResourceI ⋀ rdfs:ResourceI∈CEXTI(rdfs:ClassI) rdfs:Class rdfs:Resource
Twist Relation of cl:standard-object and cl:standard-class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) cl:standard-class cl:standard-object
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) • rdfs:ClassI⊑ rdfs:ResourceI ⋀ rdfs:ResourceI∈CEXTI(rdfs:ClassI) cl:standard-class rdfs:Class cl:standard-object rdfs:Resource
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) • rdfs:ClassI⊑ rdfs:ResourceI ⋀ rdfs:ResourceI∈CEXTI(rdfs:ClassI) cl:standard-class rdfs:Class cl:standard-object rdfs:Resource
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) metaRDFSclass RDFSclass cl:standard-class rdfs:Class cl:standard-object rdfs:Resource
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) metaRDFSclass RDFSclass cl:standard-class rdfs:Class ICEXT(IS(cl:standard-object)) ICEXT(IS(rdfs:Resource)) cl:standard-object rdfs:Resource
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) metaRDFSclass RDFSclass cl:standard-class rdfs:Class ICEXT(IS(cl:standard-object)) ICEXT(IS(rdfs:Resource)) IS(cl:standard-class) cl:standard-object rdfs:Resource
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) metaRDFSclass RDFSclass cl:standard-class rdfs:Class ICEXT(IS(cl:standard-object)) ICEXT(IS(rdfs:Resource)) IS(cl:standard-class) cl:standard-object rdfs:Resource IS(rdfs:Class)
Twist Relation of rdfs:Resource and rdfs:Class • cl:standard-classI⊑ cl:standard-objectI ⋀ cl:standard-objectI∈CEXTI(cl:standard-classI) metaRDFSclass RDFSclass cl:standard-class rdfs:Class ICEXT(IS(cl:standard-object)) ICEXT(IS(rdfs:Resource)) IS(cl:standard-class) cl:standard-object rdfs:Resource IS(rdfs:Class)
Cyc Ontology 6, * VariedOrderCollection 2,.3,4,5,6, * 2,.3,4,5,6, * 2,.3,4,5,6, * CollectionType SetOrCollectionType CollectionTypeType 1,2,3,4,5,6, * 1,2,3,4,5,6, * 4 SetOrCollection Collection FourthOrderCollection 1,2,3,4,5 3 ThirdOrderCollection FixedOrderCollection 2 SecondOrderCollection 1 FirstOrderCollection
CLOS-Clean Ontology • No class can have any direct and indirect cyclic loop in subclass relation. • No class can have any direct and indirect membership loop but the direct loop of cl:standard-class. • A parallel relation of subclass and membership can exist anywhere among metaclasses. • A twist relation of subclass and membership can exist anywhere among classes and metaclasses.
CLOS Clean Ontology Pattern k1 c m1 m2 m3 o c1 c2 c3
CLOS Clean Ontology Pattern k1 c m1 m2 m3 o c1 c2 c3 O = ICEXT(o) C2 C M2
CLOS Clean Ontology Pattern k1 c m1 m2 m3 o c1 c2 c3 O M1 C M2
Naive Hierarchical Structure of SUMO rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit rdfs:Resource sumo:Entity sumo:Abstract sumo:Quantity sumo:PhysicalQuantity sumo:ConstantQuantity sumo:LengthMeasure sumo:Meter
Naive Hierarchical Structure of SUMO rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit rdfs:Resource sumo:Entity sumo:Abstract sumo:Quantity sumo:PhysicalQuantity sumo:ConstantQuantity sumo:LengthMeasure sumo:Meter
Naive Hierarchical Structure of SUMO rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit rdfs:Resource sumo:Entity sumo:Abstract sumo:Quantity sumo:PhysicalQuantity sumo:ConstantQuantity sumo:LengthMeasure sumo:Meter
Naive Hierarchical Structure of SUMO rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit rdfs:Resource sumo:Entity sumo:Abstract sumo:Quantity sumo:PhysicalQuantity sumo:ConstantQuantity sumo:LengthMeasure sumo:Meter
Hierarchical Structure of SUMO rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit rdfs:Resource sumo:Entity sumo:Abstract sumo:Quantity sumo:PhysicalQuantity sumo:ConstantQuantity sumo:LengthMeasure sumo:Meter
Domain Inclusiveness of CLOS eql-specializer standard-class specializer class forward-referenced-class t standard-object metaobject slot-definition built-in-class method-combination funcallable-standard-class method standard-method ICEXT(IS(cl:standard-class)) ICEXT(IS(cl:standard-object)) ICEXT(IS(cl:meta-object)) ICEXT(IS(cl:specializer)) ICEXT(IS(cl:class))
Compound Type Specifieres • And • denotes the set of all objects of the type determined by the intersection of the type specs • Or • denotes the set of all objects of the type determined by the union of the type specs • Not • denotes the set of all objects that are not of the type specs ANSI Common Lisp specifies the compound type specifieres;
Compound Type Specifieres • And • denotes the set of all objects of the type determined by the intersection of the type specs • Or • denotes the set of all objects of the type determined by the union of the type specs • Not • denotes the set of all objects that are not of the type specs ANSI Common Lisp specifies the compound type specifieres; determin? class extensions determin? class extensions class extensions
Ternary Truth Table • cl:subtypep • In ANSI Common Lisp returns two values. Then, 〈t, t〉 or 〈nil, t〉 when it is determined but 〈nil, nil〉 when it is not determined. True False Unknown
Ternary Truth Table Conjunction Disjunction Negation
Ternary Truth Table Rewriting Rules for Inclusiveness
Simple Query for Compound Types (defparameter a (defclass a () ())) (defparameter b (defclass b () ())) Query 1: (subtypep ' (and a b) a) Query 2: (subtypep a ' (and a b)) Query 3: (subtypep ' (or a b) a) Query 4: (subtypep a ' (or a b)) Query 5: (subtypep ' (not a) a) Query 6: (subtypep a ' (not a))
Simple Query for Compound Types • And • CEXTI(x ⋀ y)≡ CEXTI(x) ⋂ CEXTI(y) • Or • CEXTI(x⋁y)≡ CEXTI(x) ⋃ CEXTI(y) • Not • ¬CEXTI(x)≡ CEXTI(cl:standard-object) ∖ CEXTI(y) ICEXT(IS(cl:standard-object)) ICEXT(IS(y))
Meta-modeling and Reflection • Meta-modeling in SWCLOS UnitOfMeasureClass rdfs:Class sumo:UnitOfMeasure sumo:SystemeInternationalUnit
Meta-modeling and Reflection • Meta-modeling in SWCLOS (defConcept UnitOfMeasureClass (rdfs:type rdfs:Class) (rdfs:subClassOf rdfs:Class)) (defProperty p1 (rdfs:domain UnitofMeasureClass))
Conclusion • Explained meta-circularity and meta-modeling in CLOS in terms of denotational and extensional semantics, which are obtained from the W3C document of RDF Semantics Recommendation. • The membership loop of the cl:standard-class and the twist relation between cl:standard-class and cl:standard-object are similar to those of the rdfs:Class and rdfs:Resource. • Addressed the CLOS clean meta-modeling for ontology construction.
Steel-Bank-Common-Lisp SB-MOP:SPECIALIZER SB-PCL::EXACT-CLASS-SPECIALIZER SB-PCL::SPECIALIZER-WITH-OBJECT SB-MOP:SLOT-DEFINITION SB-PCL::STANDARD-SPECIALIZER SB-MOP::METAOBJECT METHOD-COMBINATION METHOD GENERIC-FUNCTION T SB-PCL::SLOT-OBJECT STANDRD-OBJECT FUNDAMENTAL-STREAM SB-PCL::PLIST-MIXIN SB-PCL::DEFINITION-SOURCE-MIXIN STRUCTURE-OBJECT SB-MOP:FUNCALLABLE-STANDARD-OBJECT CONDITION
Steel-Bank-Common-Lisp BUILT-IN-CLASS SB-MOP::FORWARD-REFERENCED-CLASS SB-PCL::STANDARD-SPECIALIZER CLASS SB-PCL::PCL-CLASS SB-PCL::SLOT-CLASS SB-MOP:EQL-SPECIALIZER SB-PCL::CLASS-PROTOTYPE-SPECIALIZER SB-PCL::CLASS-EQ-SPECIALIZER STRUCTURE-CLASS SB-PCL::CONDITION-CLASS SB-PCL::STD-CLASS STANDARD-CLASS SB-MOP:FUNCALLABLE-STANDARD-CLASS
LispWorks STRUCTURE-CLASS STANDARD-CLASS CLASS FORWARD-REFERENCED-CLASS BUILT-IN-CLASS METAOBJECT SLOT-DEFINITION METHOD-COMBINATION METHOD GENERIC-FUNCTION T STANDRD-OBJECT LISPWORKS-TOOLS::APPLICATION CAPI:GRAPH-OBJECT CAPI::DROP-OBJECT :
Allegro aclmop:funcallable-standard-class excl::std-class standard-class excl::clos-class structure-class excl::nonstd-class class foreign-functions::foreign-structure aclmop:specializer aclmop:eql-specializer aclmop:metaobject aclmop:slot-definition method-combination method generic-function t standard-object excl::plist-mixin aclmop:funcallable-standard-object condition :