deep integration of python with semantic web technologies
Post on 01-Jan-2017
229 Views
Preview:
TRANSCRIPT
Deep integration of Python with Semantic Web
technologiesMarian Babik Ladislav Hluchy
Intelligent and Knowledge Technologies Group
Institute of Informatics SAS
5thJuly 2006 EuroPython CERN Geneve
Goals of the presentationBrief introduction of Semantic Web technologiesIntroduce deep integration ideasShow initial implementation of the Python integrated with OWLDiscuss architecture
5thJuly 2006 EuroPython CERN Geneve
Semantic WebExtension of the current Web providing infrastructure for the integration of data on the Web
Data should be available for further processingIt should be possible to combine and merge data on a Web scaleMetadata reasoning
Making data machine processableNames for resourcesCommon data model RDFAccess to the data SPARQL OWL-QLDefine vocabularies RDFS OWL SKOSReasoning OWL Rules
5thJuly 2006 EuroPython CERN Geneve
Resource Description Framework (RDF)
Based on triples (subject predicate object)Labelled connection btw two resources (subject object)Subject predicate are URI-s Object is URI (eg Subject) or Literal ( httpwwwmarianbabikorg httpmyCalendar httpcalendar )
(subject predicate object) can be seen as a labeled edge in a graphSerialization XML Turtle N3 etc
5thJuly 2006 EuroPython CERN Geneve
RDF example
httpwwwtukeskfei-citbabik
Marian Babik
httpwwwsemanticscriphellipPaper1pdf
shasName
shasWritten
ltrdfDescriptionrdfabout=httpwwwtukeskfei-citbabikgt
ltshasNamegtMarian BabikltshasNamegtltshasWritten
rdfresource=httpwwwsemanticscriptingorgSFSW2006Paper1pdfgtltrdfDescriptiongt
Turtl
e (N
3)
X
ML
RD
F
lthttpwwwtukeskfei-citbabikgtshasName ldquoMarian BabikrdquoshasWritten lthttpwwwsemanticscriptingorgSFSW2006Paper1pdfgt
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Goals of the presentationBrief introduction of Semantic Web technologiesIntroduce deep integration ideasShow initial implementation of the Python integrated with OWLDiscuss architecture
5thJuly 2006 EuroPython CERN Geneve
Semantic WebExtension of the current Web providing infrastructure for the integration of data on the Web
Data should be available for further processingIt should be possible to combine and merge data on a Web scaleMetadata reasoning
Making data machine processableNames for resourcesCommon data model RDFAccess to the data SPARQL OWL-QLDefine vocabularies RDFS OWL SKOSReasoning OWL Rules
5thJuly 2006 EuroPython CERN Geneve
Resource Description Framework (RDF)
Based on triples (subject predicate object)Labelled connection btw two resources (subject object)Subject predicate are URI-s Object is URI (eg Subject) or Literal ( httpwwwmarianbabikorg httpmyCalendar httpcalendar )
(subject predicate object) can be seen as a labeled edge in a graphSerialization XML Turtle N3 etc
5thJuly 2006 EuroPython CERN Geneve
RDF example
httpwwwtukeskfei-citbabik
Marian Babik
httpwwwsemanticscriphellipPaper1pdf
shasName
shasWritten
ltrdfDescriptionrdfabout=httpwwwtukeskfei-citbabikgt
ltshasNamegtMarian BabikltshasNamegtltshasWritten
rdfresource=httpwwwsemanticscriptingorgSFSW2006Paper1pdfgtltrdfDescriptiongt
Turtl
e (N
3)
X
ML
RD
F
lthttpwwwtukeskfei-citbabikgtshasName ldquoMarian BabikrdquoshasWritten lthttpwwwsemanticscriptingorgSFSW2006Paper1pdfgt
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Semantic WebExtension of the current Web providing infrastructure for the integration of data on the Web
Data should be available for further processingIt should be possible to combine and merge data on a Web scaleMetadata reasoning
Making data machine processableNames for resourcesCommon data model RDFAccess to the data SPARQL OWL-QLDefine vocabularies RDFS OWL SKOSReasoning OWL Rules
5thJuly 2006 EuroPython CERN Geneve
Resource Description Framework (RDF)
Based on triples (subject predicate object)Labelled connection btw two resources (subject object)Subject predicate are URI-s Object is URI (eg Subject) or Literal ( httpwwwmarianbabikorg httpmyCalendar httpcalendar )
(subject predicate object) can be seen as a labeled edge in a graphSerialization XML Turtle N3 etc
5thJuly 2006 EuroPython CERN Geneve
RDF example
httpwwwtukeskfei-citbabik
Marian Babik
httpwwwsemanticscriphellipPaper1pdf
shasName
shasWritten
ltrdfDescriptionrdfabout=httpwwwtukeskfei-citbabikgt
ltshasNamegtMarian BabikltshasNamegtltshasWritten
rdfresource=httpwwwsemanticscriptingorgSFSW2006Paper1pdfgtltrdfDescriptiongt
Turtl
e (N
3)
X
ML
RD
F
lthttpwwwtukeskfei-citbabikgtshasName ldquoMarian BabikrdquoshasWritten lthttpwwwsemanticscriptingorgSFSW2006Paper1pdfgt
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Resource Description Framework (RDF)
Based on triples (subject predicate object)Labelled connection btw two resources (subject object)Subject predicate are URI-s Object is URI (eg Subject) or Literal ( httpwwwmarianbabikorg httpmyCalendar httpcalendar )
(subject predicate object) can be seen as a labeled edge in a graphSerialization XML Turtle N3 etc
5thJuly 2006 EuroPython CERN Geneve
RDF example
httpwwwtukeskfei-citbabik
Marian Babik
httpwwwsemanticscriphellipPaper1pdf
shasName
shasWritten
ltrdfDescriptionrdfabout=httpwwwtukeskfei-citbabikgt
ltshasNamegtMarian BabikltshasNamegtltshasWritten
rdfresource=httpwwwsemanticscriptingorgSFSW2006Paper1pdfgtltrdfDescriptiongt
Turtl
e (N
3)
X
ML
RD
F
lthttpwwwtukeskfei-citbabikgtshasName ldquoMarian BabikrdquoshasWritten lthttpwwwsemanticscriptingorgSFSW2006Paper1pdfgt
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
RDF example
httpwwwtukeskfei-citbabik
Marian Babik
httpwwwsemanticscriphellipPaper1pdf
shasName
shasWritten
ltrdfDescriptionrdfabout=httpwwwtukeskfei-citbabikgt
ltshasNamegtMarian BabikltshasNamegtltshasWritten
rdfresource=httpwwwsemanticscriptingorgSFSW2006Paper1pdfgtltrdfDescriptiongt
Turtl
e (N
3)
X
ML
RD
F
lthttpwwwtukeskfei-citbabikgtshasName ldquoMarian BabikrdquoshasWritten lthttpwwwsemanticscriptingorgSFSW2006Paper1pdfgt
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
RDF Vocabulary Description Language (RDFS)
RDF lacks vocabulary with semantic meaningRDFS defines resources and classes and relationships among classesresource
rdftype rdfsClass rdfssubClassOfrdfssubPropertyOf Resource may belong to several classes (range domain)
Special kind of type system
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
RDFS example
John Man
Person
rdftype
rdftyperdfssubClassOf
Person rdfssubClassOf Man
John rdftype Man
ltrdfDescription rdfID=ldquoJohnrdquogt
ltrdftype rdfresource=ldquoManrdquogt
ltrdfDescriptiongt
ltrdfDescription rdfID=ldquoManrdquogt
ltrdfssubClassOfrdfresource=ldquoPersonrdquogt
ltrdfDescriptiongt
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
RDFS example (2)Person rdfssubClassOf Man John rdftype Man isProgrammerrdftype rdfPropertyrdfdomain Personrdfrange rdfsLiteral
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Web Ontology Language (OWL)RDFS doesnrsquot solve all the issues
Reasoning about termsBehavior of properties (symmetric transitive etc)Cardinality constraintsEquivalence of classesEnumeration (oneOf) union of classes Datatype properties
Compromise btwRich semantics Feasibility implementability
Three layersOWL-Lite OWL-DL (based on Description Logic ndash SHOIN(D))OWL-Full (might be undecidable)
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
OWL-DLClass definition axioms
Complex class definitions based on the class descriptions
Property definition axiomsRDF Schema constructs (rdfssubPropertyOf rdfsdomain and rdfsrange)relations to other properties owlequivalentProperty and owlinverseOf)global cardinality constraints owlFunctionalProperty and owlInverseFunctionalPropertylogical property characteristics owlSymmetricProperty and owlTransitiveProperty
Individualsfacts about class membership and property values of individuals
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
OWL-DL exampleprefix people lthttpsampleorgpeoplegt
peoplePerson a owlClass peopleMan a owlClass rdfssubClassOf peoplePersonpeoplehasChild a owlProperty peoplehasSon a owlPropery rdfssubPropertyOf peoplehasChild
PersonWithSingleSon a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf
[ a owlRestriction owlcardinality 1^^ owlonProperty hasChild ]
PeopleJohn a peoplePerson PeopleBob a peoplePersonWithSingleSon
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
SW for developersClasses are types for instances Classes are sets of individualsEach instance has one class (as its type) Classes donrsquot share instances
Each individual can belong to multiple classes
List of classes is known at compile time Classes can be created and changed at runtime
Compilers are used Reasoners are used for classification and consistency
Properties are defined locally to a class Properties are standalone entities (can exist without classes)
Instances have values for attached properties Values must be correctly typed Range constraints are used for type checking
Instance can have arbitrary values for any property Range and domain constraints can be used for type checking and type inference
Closed world assumption Open world assumptionClass behavior through functions and methods
Classes make their meaning explicit in terms of OWL statements
Source wwww3orgTRsw-oosd-primer
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Deep integration ideasImport OWL classes alongside classes defined normally (native API)Support for intensional definition of classesproperties (OWL statements)Separation of concerns among declarative and procedural aspectsSimilar to what SQLObject does for databases
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
BenefitsDefinition of data and domain using Semantic Web tools (Proteacutegeacute SWOOP)Native OWL APIOWL Inference and Web sharing of conceptsNew programming paradigm for PythonNative interface for ontologies developers can work directly with OWL classes and their instancesExisting Python Web frameworks and access to large set of libraries
Ont
olog
ies
Pyt
hon
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
OWL APIsJena OWL API
Different notion of polymorphism means APIs have to introduce sophisticated design patterns
Resource r = myModelgetResource( myNS + DigitalCamera ) OntClass cls = (OntClass) ras( OntClassclass ) Restriction rest = (Restriction) clsas( Restrictionclass )
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
RDFOWL APIsPython
RDFLib ndash statement-centric (Daniel Krech)CWM ndash model centricPychinko ndash model statement-centric rule basedMetaLog ndash statement resource-centric based on prologSparta Tramp ndash resource centric
OthersActive RDF (Ruby) ndash native mapping RDF integrated with RailsRDFHomepage (PHP) ndash native mapping
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
OWL-DL and Python Ontology corresponds to Python moduleOWL Class corresponds to Python ClassInstance of OWL Class corresponds to Python ObjectOWL Property corresponds to Python Class or Python method
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Classes
OWL Class corresponds to Python ClassInstances of OWL Class correspond to Python ObjectsClass definition
Each python class has two attributesURI (owlClass URI)definedBy (intensional definition)
gtgtgt from seth import Thing Property gtgtgt Person = Thingnew(lsquo Person a owlClass ) gtgtgt print Personltclass sethMetaPersongt
gtgtgt Man = Thingnew( Man a owlClass rdfssubClassOf Person )
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Classes (2)gtgtgt PersonWithSingleSon = Thingnew(PersonWithSingleSon
a owlClass rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasSon ] rdfssubClassOf[ a owlRestriction owlcardinality 1^^
owlonProperty hasChild ] )
gtgtgt model = OntModel()gtgtgt modelbind(ldquopeoplerdquordquohttpsomewherenetpeoplerdquo)gtgtgt ThingsetOntModel(model)gtgtgt Person = Thingnew(ldquo peoplePerson a owlClass rdquo)
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Properties
owlProperty corresponds to special kind of python object
Similar to Class definitionBut such classes donrsquot have instances
owlProperty corresponds to python object attribute (method)
gtgtgt hasChild = Propertynew(hasChild a owlObjectProperty )gtgtgt print hasChildltclass sethMetahasChildgtgtgtgt hasSon = Propertynew(hasSon a owlObjectProperty rdfssubPropertyOf hasChild )
gtgtgt JohnhasChild(Bob)
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
IndividualsIndividual is python object (class instance)
gtgtgt Bob = PersonWithSingleSon(lsquoBobrsquo)gtgtgt John = Person(Johnlsquo)gtgtgt print John ltsethMetaPerson object at 0xb7a29e4cgtgtgtgt hasChild(Bob John)
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
OntologiesowlOntology corresponds to Pythonrsquos module
gtgtgt ModuleFactory(ldquopeoplerdquo ldquohttpsomewherenetpeopleowlrdquo)gtgtgt import peoplegtgtgt print peoplePersonltsethpeoplePersonMan a owlClass rdfssubClassOf Person gtgtgt print peopleJohnltsethpeoplePerson object at 0xb7a29e4cgtserializationgtgtgt peopleserialize(ldquotmptestowlrdquo ldquoRDFXML-ABBREVrdquo)
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
QueriesTriple like queriesgtgtgt for individual in PersonfindInstances() print individual individualnameltsethMetaMan object at 0xb7d0b64cgt PeterltsethMetaPerson object at 0xb7d0b50cgt JohnltsethMetaPerson object at 0xb7d0b6ecgt Janegtgtgt for who in hasSonq(Bob) whonameJohngtgtgt print hasSonquery(Bob John)1
OWL-QL SPARQLNative queries
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
ArchitectureInteraction with Java-based libraries (reasoners)
FileURIRDFXML OntModel
ClassProperty Generators
Knowledge Base Interface
Interactive
Query EngineQuery language
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
Python and JavaJython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
IssuesPerformance (conversion between JVMs)CacheDatatype propertiesOpen world semanticsDebuggingRules
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
SummarySETH Homepagehttpseth-scriptingsourceforgenetAvailable through CVS under MIT licenseDiscussion support mailing listsethuisavbask
ContactMarianBabikgmailcom
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
5thJuly 2006 EuroPython CERN Geneve
ReferencesIntroduction to Semantic Web
httpwwww3org2006Talks0524-Edinburgh-IHOverviewpdf
Deep IntegrationhttpwwwsemanticscriptingorgSFSW2005papersVrandecic-Deep_Integrationpdf httpgigatonthoughtworksnet~ofernand1DeepIntegrationpdf
httpwwwsemanticscriptingorgSFSW2006Paper1pdf
top related