SlideShare a Scribd company logo
Scalable and Reactive
Programming for Semantic
Web Developers
Jean-Paul Calbimonte
LSIR EPFL
Developers Workshop. Extended Semantic Web Conference ESWC 2015
Portoroz, 31.05.2015
@jpcik
Semantic Web Devs
2
Have fun
Love challenges
Need cool tools
Sesame
Scala: Functions and Objects
3
JVM language
Both object and functional oriented
Easy Java-interop
Reuse Java libraries
Growing community
RDF in Jena: in Scala
String personURI = "http://somewhere/JohnSmith";
Model model = ModelFactory.createDefaultModel();
model.createResource(personURI).addProperty(VCARD.FN,"John Smith");
Type inference
Not too useful
; and ()
4
Terser & compact code
Type-safe DSL
Compiler takes care
val personURI = "http://somewhere/JohnSmith"
val model = ModelFactory.createDefaultModel
model.createResource(personURI).addProperty(VCARD.FN,"John Smith")
sw:JohnSmith “John Smith”
vcard:FN
val personURI = "http://somewhere/JohnSmith"
implicit val model = createDefaultModel
add(personURI,VCARD.FN->"John Smith")
boilerplate
String converted
to Resource
Some more RDF
5
String personURI = "http://somewhere/JohnSmith";
String givenName = "John";
String familyName = "Smith";
String fullName = givenName + " " + familyName;
Model model = ModelFactory.createDefaultModel();
model.createResource(personURI)
.addProperty(VCARD.FN,fullName)
.addProperty(VCARD.N,model.createResource()
.addProperty(VCARD.Given,givenName)
.addProperty(VCARD.Family,familyName));
val personURI = "http://somewhere/JohnSmith"
val givenName = "John"
val familyName = "Smith"
val fullName = s"$givenName $familyName"
implicit val model = createDefaultModel
add(personURI,VCARD.FN->fullName,
VCARD.N ->add(bnode,VCARD.Given -> givenName,
VCARD.Family->familyName))
sw:JohnSmith
“John Smith”
vcard:FN
_:n
“John”
“Smith”vcard:N
vcard:Given
vcard:Family
Blank node
Scala DSLs customizable
Predicate-objects are pairs
Some more RDF in Jena
6
implicit val m=createDefaultModel
val ex="http://example.org/"
val alice=iri(ex+"alice")
val bob=iri(ex+"bob")
val charlie=iri(ex+"charlie")
alice+(RDF.`type`->FOAF.Person,
FOAF.name->"Alice",
FOAF.mbox-
>iri("mailto:alice@example.org"),
FOAF.knows->bob,
FOAF.knows->charlie, FOAF.knows->bnode)
bob+ (FOAF.name->"Bob",
FOAF.knows->charlie)
charlie+(FOAF.name->"Charlie",
FOAF.knows->alice)
Still valid Jena RDF
You can do it even nicer
Exploring an RDF Graph
7
ArrayList<String> names=new ArrayList<String>();
NodeIterator iter=model.listObjectsOfProperty(VCARD.N);
while (iter.hasNext()){
RDFNode obj=iter.next();
if (obj.isResource())
names.add(obj.asResource()
.getProperty(VCARD.Family).getObject().toString());
else if (obj.isLiteral())
names.add(obj.asLiteral().getString());
}
val names=model.listObjectsOfProperty(VCARD.N).map{
case r:Resource=>
r.getProperty(VCARD.Family).obj.toString
case l:Literal=>
l.getString
}
Imperative iteration of collections
Type-based conditional execution
Type casting
Case type
Map applied to operators
8
Query with SPARQL
9
val queryStr = """select distinct ?Concept
where {[] a ?Concept} LIMIT 10"""
val query = sparql(queryStr)
query.serviceSelect("http://dbpedia.org/sparql").foreach{implicit qs=>
println(res("Concept").getURI)
}
val f=Future(query.serviceSelect("http://es.dbpedia.org/sparql")).fallbackTo(
Future(query.serviceSelect("http://dbpedia.org/sparql")))
f.recover{
case e=> println("Error "+e.getMessage)
}
f.map(_.foreach{implicit qs=>
println(res("Concept").getValue)
})
Remote SPARQL endpoint
Simplified access to
Query solutions
Futures: asnyc execution
Non blocking code
Fallback alternative execution
Actor Model
10
Actor
1
Actor
2
m
No shared mutable state
Avoid blocking operators
Lightweight objects
Loose coupling
communicate
through messages
mailbox
state
behavior
non-blocking response
send: fire-forget
Implementations: e.g. Akka for Java/Scala
Pare
nt
Actor
1
Supervision
hierarchy
Supervision
Actor
2
Actor
4
X
Actor
2
Act
or1
Act
or2
m
Act
or3
Act
or4
m
m
Remoting
Reactive Systems
Event-Driven
Jonas Boner. Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems. 2013.
Events:
reactto
ScalableLoad:
ResilientFailure:
ResponsiveUsers:
11
RDF Streams: Actors
12
val sys=ActorSystem.create("system")
val consumer=sys.actorOf(Props[RdfConsumer])
class Streamer extends StreamRDF{
override def triple(triple:Triple){
consumer ! triple
}
}
class RdfConsumer extends Actor{
def receive= {
case t:Triple =>
if (t.predicateMatches(RDF.‘type‘))
println(s"received triple $t")
}
RDF consumer
Actor receive method
Implements behavior
Message-passing model
RDF producer
Async message passing
Web RDF Services
13
GET /containers/:containerid/ org.rsp.ldp.ContainerApp.retrieve(containerid:String)
POST /containers/:containerid/ org.rsp.ldp.ContainerApp.add(containerid:String)
object ContainerApp extends Controller {
def retrieve(id:String) = Action.async {implicit request=>
val sw=new StringWriter
val statements=m.listStatements(iri(prefix+id+"/"),null,null)
val model=createDefaultModel
statements.foreach(i=>model.add(i))
model.write(sw, "TURTLE")
Future(Ok(sw.toString).as("text/turtle").withHeaders(
ETAG->tag,
ALLOW->"GET,POST"
))
}
Routing rules
Controller returns RDF async
OWLAPI: reasoning
14
val onto=mgr.createOntology
val artist=clazz(pref+"Artist")
val singer=clazz(pref +"Singer")
onto += singer subClassOf artist
val reasoner = new RELReasonerFactory.createReasoner(onto)
val elvis=ind(pref+"Elvis")
reasoner += elvis ofClass singer
reasoner.reclassify
reasoner.getIndividuals(artist) foreach{a=>
println(a.getRepresentativeElement.getIRI)
}
Creating OWL classes
Declaring class relationships
Declare instances
How is it done?
15
object OwlApiTips{
implicit class TrowlRelReasoner(reasoner:RELReasoner){
def += (axiom:OWLAxiom)= reasoner.add(Set(axiom)) }
implicit class OwlClassPlus(theClass:OWLClass){
def subClassOf(superclass:OWLClass)(implicit fac:OWLDataFactory)=
fac.getOWLSubClassOfAxiom(theClass, superclass) }
implicit class OwlOntologyPlus(onto:OWLOntology){
def += (axiom:OWLAxiom)(implicit mgr:OWLOntologyManager)=
mgr.addAxiom(onto, axiom) }
implicit class OwlIndividualPlus(ind:OWLIndividual){
def ofClass (theclass:OWLClass)(implicit fac:OWLDataFactory)=
fac.getOWLClassAssertionAxiom(theclass, ind) }
implicit def str2Iri(s:String):IRI=IRI.create(s)
object clazz{
def apply(iri:String)(implicit fac:OWLDataFactory)=
fac.getOWLClass(iri) }
object ind{
def apply(iri:String)(implicit fac:OWLDataFactory)=
fac.getOWLNamedIndividual(iri) } }
Muchas gracias!
Jean-Paul Calbimonte
LSIR EPFL
@jpcik

More Related Content

PPTX
Streams of RDF Events Derive2015
PPTX
RDF Stream Processing: Let's React
PPT
OrdRing 2013 keynote - On the need for a W3C community group on RDF Stream Pr...
PDF
RDF Stream Processing Models (SR4LD2013)
PDF
Querying the Web of Data with XSPARQL 1.1
PDF
The Materials Project Ecosystem - A Complete Software and Data Platform for M...
PDF
RxJS - The Reactive Extensions for JavaScript
PDF
Scala Days NYC 2016
Streams of RDF Events Derive2015
RDF Stream Processing: Let's React
OrdRing 2013 keynote - On the need for a W3C community group on RDF Stream Pr...
RDF Stream Processing Models (SR4LD2013)
Querying the Web of Data with XSPARQL 1.1
The Materials Project Ecosystem - A Complete Software and Data Platform for M...
RxJS - The Reactive Extensions for JavaScript
Scala Days NYC 2016

What's hot (20)

PPT
2008 11 13 Hcls Call
PDF
Why Scala Is Taking Over the Big Data World
PDF
WebTech Tutorial Querying DBPedia
PDF
Linking the world with Python and Semantics
PDF
Semantic Integration with Apache Jena and Stanbol
PDF
The Materials Project - Combining Science and Informatics to Accelerate Mater...
PDF
Martin Odersky - Evolution of Scala
PDF
What To Leave Implicit
PDF
Querying Linked Data with SPARQL
PPTX
SPARQL Cheat Sheet
PDF
Java collections the force awakens
PPT
Scala Days San Francisco
PPTX
Apache Jena Elephas and Friends
PPTX
Semantic web meetup – sparql tutorial
PPT
PPTX
Information-Rich Programming in F# with Semantic Data
PPTX
Beyond shuffling - Strata London 2016
PPTX
Scala - The Simple Parts, SFScala presentation
PDF
Collections forceawakens
2008 11 13 Hcls Call
Why Scala Is Taking Over the Big Data World
WebTech Tutorial Querying DBPedia
Linking the world with Python and Semantics
Semantic Integration with Apache Jena and Stanbol
The Materials Project - Combining Science and Informatics to Accelerate Mater...
Martin Odersky - Evolution of Scala
What To Leave Implicit
Querying Linked Data with SPARQL
SPARQL Cheat Sheet
Java collections the force awakens
Scala Days San Francisco
Apache Jena Elephas and Friends
Semantic web meetup – sparql tutorial
Information-Rich Programming in F# with Semantic Data
Beyond shuffling - Strata London 2016
Scala - The Simple Parts, SFScala presentation
Collections forceawakens
Ad

Viewers also liked (6)

PPT
Aturansinus
PDF
Take a Look at Akka+Java (English version)
PDF
Reactive programming using rx java & akka actors - pdx-scala - june 2014
PPTX
RDF Stream Processing Tutorial: RSP implementations
PDF
Introduction to Scala for Java Developers
PPTX
Reactive Java (GeeCON 2014)
Aturansinus
Take a Look at Akka+Java (English version)
Reactive programming using rx java & akka actors - pdx-scala - june 2014
RDF Stream Processing Tutorial: RSP implementations
Introduction to Scala for Java Developers
Reactive Java (GeeCON 2014)
Ad

Similar to Scala Programming for Semantic Web Developers ESWC Semdev2015 (20)

PPT
Laurens Van Den Oever Xopus Presentation
PDF
Akka lsug skills matter
PDF
Scaling Web Apps with Akka
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
PDF
Reactive Web-Applications @ LambdaDays
PPTX
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
PDF
Advanced akka features
PDF
Scala and jvm_languages_praveen_technologist
PPTX
Introduction to Apache Camel
PDF
Building Concurrent WebObjects applications with Scala
PPT
Scala uma poderosa linguagem para a jvm
PPTX
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
PDF
Full Stack Scala
KEY
JavaScript Growing Up
PDF
Java, what's next?
PDF
Virtualizing Java in Java (jug.ru)
PPT
JS everywhere 2011
PPTX
Developing a Real-time Engine with Akka, Cassandra, and Spray
PDF
Scala for the doubters. Максим Клыга
PDF
Play framework
Laurens Van Den Oever Xopus Presentation
Akka lsug skills matter
Scaling Web Apps with Akka
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Reactive Web-Applications @ LambdaDays
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Advanced akka features
Scala and jvm_languages_praveen_technologist
Introduction to Apache Camel
Building Concurrent WebObjects applications with Scala
Scala uma poderosa linguagem para a jvm
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Full Stack Scala
JavaScript Growing Up
Java, what's next?
Virtualizing Java in Java (jug.ru)
JS everywhere 2011
Developing a Real-time Engine with Akka, Cassandra, and Spray
Scala for the doubters. Максим Клыга
Play framework

More from Jean-Paul Calbimonte (20)

PDF
Towards Collaborative Creativity in Persuasive Multi-agent Systems
PDF
A Platform for Difficulty Assessment and Recommendation of Hiking Trails
PDF
Stream reasoning agents
PPTX
Decentralized Management of Patient Profiles and Trajectories through Semanti...
PDF
Personal Data Privacy Semantics in Multi-Agent Systems Interactions
PPTX
RDF data validation 2017 SHACL
PPTX
SanTour: Personalized Recommendation of Hiking Trails to Health Pro files
PPTX
Multi-agent interactions on the Web through Linked Data Notifications
PPTX
The MedRed Ontology for Representing Clinical Data Acquisition Metadata
PPTX
Linked Data Notifications for RDF Streams
PPTX
Fundamentos de Scala (Scala Basics) (español) Catecbol
PPTX
Connecting Stream Reasoners on the Web
PPTX
Query Rewriting in RDF Stream Processing
PPTX
Toward Semantic Sensor Data Archives on the Web
PPTX
Detection of hypoglycemic events through wearable sensors
PPTX
RDF Stream Processing and the role of Semantics
PPTX
The Schema Editor of OpenIoT for Semantic Sensor Networks
PPTX
XGSN: An Open-source Semantic Sensing Middleware for the Web of Things
PPT
X-GSN in OpenIoT SummerSchool
PPTX
GSN Global Sensor Networks for Environmental Data Management
Towards Collaborative Creativity in Persuasive Multi-agent Systems
A Platform for Difficulty Assessment and Recommendation of Hiking Trails
Stream reasoning agents
Decentralized Management of Patient Profiles and Trajectories through Semanti...
Personal Data Privacy Semantics in Multi-Agent Systems Interactions
RDF data validation 2017 SHACL
SanTour: Personalized Recommendation of Hiking Trails to Health Pro files
Multi-agent interactions on the Web through Linked Data Notifications
The MedRed Ontology for Representing Clinical Data Acquisition Metadata
Linked Data Notifications for RDF Streams
Fundamentos de Scala (Scala Basics) (español) Catecbol
Connecting Stream Reasoners on the Web
Query Rewriting in RDF Stream Processing
Toward Semantic Sensor Data Archives on the Web
Detection of hypoglycemic events through wearable sensors
RDF Stream Processing and the role of Semantics
The Schema Editor of OpenIoT for Semantic Sensor Networks
XGSN: An Open-source Semantic Sensing Middleware for the Web of Things
X-GSN in OpenIoT SummerSchool
GSN Global Sensor Networks for Environmental Data Management

Recently uploaded (20)

PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Project quality management in manufacturing
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Digital Logic Computer Design lecture notes
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
web development for engineering and engineering
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Welding lecture in detail for understanding
PPTX
Construction Project Organization Group 2.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
PPT on Performance Review to get promotions
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
UNIT-1 - COAL BASED THERMAL POWER PLANTS
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Project quality management in manufacturing
Internet of Things (IOT) - A guide to understanding
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
additive manufacturing of ss316l using mig welding
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Digital Logic Computer Design lecture notes
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
web development for engineering and engineering
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
CYBER-CRIMES AND SECURITY A guide to understanding
Welding lecture in detail for understanding
Construction Project Organization Group 2.pptx
R24 SURVEYING LAB MANUAL for civil enggi
PPT on Performance Review to get promotions

Scala Programming for Semantic Web Developers ESWC Semdev2015

  • 1. Scalable and Reactive Programming for Semantic Web Developers Jean-Paul Calbimonte LSIR EPFL Developers Workshop. Extended Semantic Web Conference ESWC 2015 Portoroz, 31.05.2015 @jpcik
  • 2. Semantic Web Devs 2 Have fun Love challenges Need cool tools Sesame
  • 3. Scala: Functions and Objects 3 JVM language Both object and functional oriented Easy Java-interop Reuse Java libraries Growing community
  • 4. RDF in Jena: in Scala String personURI = "http://somewhere/JohnSmith"; Model model = ModelFactory.createDefaultModel(); model.createResource(personURI).addProperty(VCARD.FN,"John Smith"); Type inference Not too useful ; and () 4 Terser & compact code Type-safe DSL Compiler takes care val personURI = "http://somewhere/JohnSmith" val model = ModelFactory.createDefaultModel model.createResource(personURI).addProperty(VCARD.FN,"John Smith") sw:JohnSmith “John Smith” vcard:FN val personURI = "http://somewhere/JohnSmith" implicit val model = createDefaultModel add(personURI,VCARD.FN->"John Smith") boilerplate String converted to Resource
  • 5. Some more RDF 5 String personURI = "http://somewhere/JohnSmith"; String givenName = "John"; String familyName = "Smith"; String fullName = givenName + " " + familyName; Model model = ModelFactory.createDefaultModel(); model.createResource(personURI) .addProperty(VCARD.FN,fullName) .addProperty(VCARD.N,model.createResource() .addProperty(VCARD.Given,givenName) .addProperty(VCARD.Family,familyName)); val personURI = "http://somewhere/JohnSmith" val givenName = "John" val familyName = "Smith" val fullName = s"$givenName $familyName" implicit val model = createDefaultModel add(personURI,VCARD.FN->fullName, VCARD.N ->add(bnode,VCARD.Given -> givenName, VCARD.Family->familyName)) sw:JohnSmith “John Smith” vcard:FN _:n “John” “Smith”vcard:N vcard:Given vcard:Family Blank node Scala DSLs customizable Predicate-objects are pairs
  • 6. Some more RDF in Jena 6 implicit val m=createDefaultModel val ex="http://example.org/" val alice=iri(ex+"alice") val bob=iri(ex+"bob") val charlie=iri(ex+"charlie") alice+(RDF.`type`->FOAF.Person, FOAF.name->"Alice", FOAF.mbox- >iri("mailto:alice@example.org"), FOAF.knows->bob, FOAF.knows->charlie, FOAF.knows->bnode) bob+ (FOAF.name->"Bob", FOAF.knows->charlie) charlie+(FOAF.name->"Charlie", FOAF.knows->alice) Still valid Jena RDF You can do it even nicer
  • 7. Exploring an RDF Graph 7 ArrayList<String> names=new ArrayList<String>(); NodeIterator iter=model.listObjectsOfProperty(VCARD.N); while (iter.hasNext()){ RDFNode obj=iter.next(); if (obj.isResource()) names.add(obj.asResource() .getProperty(VCARD.Family).getObject().toString()); else if (obj.isLiteral()) names.add(obj.asLiteral().getString()); } val names=model.listObjectsOfProperty(VCARD.N).map{ case r:Resource=> r.getProperty(VCARD.Family).obj.toString case l:Literal=> l.getString } Imperative iteration of collections Type-based conditional execution Type casting Case type Map applied to operators
  • 8. 8
  • 9. Query with SPARQL 9 val queryStr = """select distinct ?Concept where {[] a ?Concept} LIMIT 10""" val query = sparql(queryStr) query.serviceSelect("http://dbpedia.org/sparql").foreach{implicit qs=> println(res("Concept").getURI) } val f=Future(query.serviceSelect("http://es.dbpedia.org/sparql")).fallbackTo( Future(query.serviceSelect("http://dbpedia.org/sparql"))) f.recover{ case e=> println("Error "+e.getMessage) } f.map(_.foreach{implicit qs=> println(res("Concept").getValue) }) Remote SPARQL endpoint Simplified access to Query solutions Futures: asnyc execution Non blocking code Fallback alternative execution
  • 10. Actor Model 10 Actor 1 Actor 2 m No shared mutable state Avoid blocking operators Lightweight objects Loose coupling communicate through messages mailbox state behavior non-blocking response send: fire-forget Implementations: e.g. Akka for Java/Scala Pare nt Actor 1 Supervision hierarchy Supervision Actor 2 Actor 4 X Actor 2 Act or1 Act or2 m Act or3 Act or4 m m Remoting
  • 11. Reactive Systems Event-Driven Jonas Boner. Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems. 2013. Events: reactto ScalableLoad: ResilientFailure: ResponsiveUsers: 11
  • 12. RDF Streams: Actors 12 val sys=ActorSystem.create("system") val consumer=sys.actorOf(Props[RdfConsumer]) class Streamer extends StreamRDF{ override def triple(triple:Triple){ consumer ! triple } } class RdfConsumer extends Actor{ def receive= { case t:Triple => if (t.predicateMatches(RDF.‘type‘)) println(s"received triple $t") } RDF consumer Actor receive method Implements behavior Message-passing model RDF producer Async message passing
  • 13. Web RDF Services 13 GET /containers/:containerid/ org.rsp.ldp.ContainerApp.retrieve(containerid:String) POST /containers/:containerid/ org.rsp.ldp.ContainerApp.add(containerid:String) object ContainerApp extends Controller { def retrieve(id:String) = Action.async {implicit request=> val sw=new StringWriter val statements=m.listStatements(iri(prefix+id+"/"),null,null) val model=createDefaultModel statements.foreach(i=>model.add(i)) model.write(sw, "TURTLE") Future(Ok(sw.toString).as("text/turtle").withHeaders( ETAG->tag, ALLOW->"GET,POST" )) } Routing rules Controller returns RDF async
  • 14. OWLAPI: reasoning 14 val onto=mgr.createOntology val artist=clazz(pref+"Artist") val singer=clazz(pref +"Singer") onto += singer subClassOf artist val reasoner = new RELReasonerFactory.createReasoner(onto) val elvis=ind(pref+"Elvis") reasoner += elvis ofClass singer reasoner.reclassify reasoner.getIndividuals(artist) foreach{a=> println(a.getRepresentativeElement.getIRI) } Creating OWL classes Declaring class relationships Declare instances
  • 15. How is it done? 15 object OwlApiTips{ implicit class TrowlRelReasoner(reasoner:RELReasoner){ def += (axiom:OWLAxiom)= reasoner.add(Set(axiom)) } implicit class OwlClassPlus(theClass:OWLClass){ def subClassOf(superclass:OWLClass)(implicit fac:OWLDataFactory)= fac.getOWLSubClassOfAxiom(theClass, superclass) } implicit class OwlOntologyPlus(onto:OWLOntology){ def += (axiom:OWLAxiom)(implicit mgr:OWLOntologyManager)= mgr.addAxiom(onto, axiom) } implicit class OwlIndividualPlus(ind:OWLIndividual){ def ofClass (theclass:OWLClass)(implicit fac:OWLDataFactory)= fac.getOWLClassAssertionAxiom(theclass, ind) } implicit def str2Iri(s:String):IRI=IRI.create(s) object clazz{ def apply(iri:String)(implicit fac:OWLDataFactory)= fac.getOWLClass(iri) } object ind{ def apply(iri:String)(implicit fac:OWLDataFactory)= fac.getOWLNamedIndividual(iri) } }