extracting owl ontologies from agent-based modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an owl...

9
©Copyright JASSS J. Gary Polhill (2015) Extracting OWL Ontologies from Agent-Based Models: A Netlogo Extension Journal of Artificial Societies and Social Simulation 18 (2) 15 <http://jasss.soc.surrey.ac.uk/18/2/15.html> Received: 09-Oct-2014 Accepted: 24-Feb-2015 Published: 31-Mar-2015 Abstract Using OWL ontologies to represent the state and structure of a simulation at any one time has been argued to improve the transparency of a social simulation, on the basis that this information is then not embedded in the source code of the model, or in the computer's memory at run-time. Should transparency of such a form be desirable, it would be preferable to enable it by extracting the information automatically from a running model. However, semantic differences between traditional object- oriented programming languages and description logics pose an obstacle to this. This paper presents arguments that Netlogo does not have the same semantic challenges to automated ontology extraction, and describes an extension to Netlogo (5.0) using the OWL-API (3.1.0) that extracts state and structure ontologies from an existing Netlogo model. The extension is freely available from https://github.com/garypolhill/netlogo-owl. Keywords: Netlogo, OWL, OWL-API, Ontology, Transparency Introduction 1.1 Social simulation is often argued to be more transparent than other approaches to modelling social systems (e.g.Galán et al. 2009). The transparency of a social simulation can refer to the ability to relate the state and structure of a simulation to those of the target system it is intended to represent (e.g. Leydesdorff 2001), but also to the relationship between expressions in the source code and properties of the target system (e.g. Taylor 2003). In general, transparency in this context may be conceived as the ability of someone other than those immediately involved in a model's construction to understand what it is doing (e.g. Polhill & Gotts 2009). However, as Janssen et al. (2008) point out, whilst full transparency is ideal, 'translucency' – in which there is a partial exposure of the implementation – may often be all that is practical. Indeed, sometimes the latter may be preferred; for example, when discussing certain aspects of the model in inter- or trans-disciplinary teams. 1.2 Whilst computer programming languages can be reasonably argued to efficiently and formally describe algorithms, extracting the structure of a simulation (the classes of entity in the model, the properties they have, and the relationships they have with other entities) from its source code can be challenging. In an object-oriented model, the structure may be distributed across several class files, with no immediately obvious way to determine which classes are ontologically significant, and which are there to provide functionality not already provided by the language API or any programming libraries used. Although extracting UML diagrams from object-oriented code can be automated, there is the further problem that inheritance in object-oriented models reflects compiler and programmer convenience, rather than common-sense understandings (LaLonde & Pugh 1991). If there is an acceptance that logics are formalisations of common-sense understandings, then for the purposes of transparency (or translucency) rather than programming, the ideal would be that the model structure is represented using axioms of description logics. 1.3 Semantic differences between classical object-oriented programming languages and description logics have been highlighted by Polhill and Gotts (2009), with reference to Lalonde and Pugh's (1991) distinctions among the three inheritance relations subtype, subclass and is-a. Of these three, the first is for compiler convenience in checking types involved in operations (interfaces in Java), the second for programmer convenience in facilitating code re-use (classes in Java), whilst the third reflects descriptive, logical meanings that are of primary interest from an ontological point of view. These differences mean that direct ontology learning from model source code is not guaranteed in object-oriented programming languages. http://jasss.soc.surrey.ac.uk/18/2/15.html 1 20/10/2015

Upload: others

Post on 22-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

©CopyrightJASSS

J.GaryPolhill(2015)

ExtractingOWLOntologiesfromAgent-BasedModels:ANetlogoExtension

JournalofArtificialSocietiesandSocialSimulation 18(2)15<http://jasss.soc.surrey.ac.uk/18/2/15.html>

Received:09-Oct-2014Accepted:24-Feb-2015Published:31-Mar-2015

Abstract

UsingOWLontologiestorepresentthestateandstructureofasimulationatanyonetimehasbeenarguedtoimprovethetransparencyofasocialsimulation,onthebasisthatthisinformationisthennotembeddedinthesourcecodeofthemodel,orinthecomputer'smemoryatrun-time.Shouldtransparencyofsuchaformbedesirable,itwouldbepreferabletoenableitbyextractingtheinformationautomaticallyfromarunningmodel.However,semanticdifferencesbetweentraditionalobject-orientedprogramminglanguagesanddescriptionlogicsposeanobstacletothis.ThispaperpresentsargumentsthatNetlogodoesnothavethesamesemanticchallengestoautomatedontologyextraction,anddescribesanextensiontoNetlogo(5.0)usingtheOWL-API(3.1.0)thatextractsstateandstructureontologiesfromanexistingNetlogomodel.Theextensionisfreelyavailablefromhttps://github.com/garypolhill/netlogo-owl.

Keywords:Netlogo,OWL,OWL-API,Ontology,Transparency

Introduction

1.1 Socialsimulationisoftenarguedtobemoretransparentthanotherapproachestomodellingsocialsystems(e.g.Galánetal.2009).Thetransparencyofasocialsimulationcanrefertotheabilitytorelatethestateandstructureofasimulationtothoseofthetargetsystemitisintendedtorepresent(e.g.Leydesdorff2001),butalsototherelationshipbetweenexpressionsinthesourcecodeandpropertiesofthetargetsystem(e.g.Taylor2003).Ingeneral,transparencyinthiscontextmaybeconceivedastheabilityofsomeoneotherthanthoseimmediatelyinvolvedinamodel'sconstructiontounderstandwhatitisdoing(e.g.Polhill&Gotts2009).However,asJanssenetal.(2008)pointout,whilstfulltransparencyisideal,'translucency'–inwhichthereisapartialexposureoftheimplementation–mayoftenbeallthatispractical.Indeed,sometimesthelattermaybepreferred;forexample,whendiscussingcertainaspectsofthemodelininter-ortrans-disciplinaryteams.

1.2 Whilstcomputerprogramminglanguagescanbereasonablyarguedtoefficientlyandformallydescribealgorithms,extractingthestructureofasimulation(theclassesofentityinthemodel,thepropertiestheyhave,andtherelationshipstheyhavewithotherentities)fromitssourcecodecanbechallenging.Inanobject-orientedmodel,thestructuremaybedistributedacrossseveralclassfiles,withnoimmediatelyobviouswaytodeterminewhichclassesareontologicallysignificant,andwhicharetheretoprovidefunctionalitynotalreadyprovidedbythelanguageAPIoranyprogramminglibrariesused.AlthoughextractingUMLdiagramsfromobject-orientedcodecanbeautomated,thereisthefurtherproblemthatinheritanceinobject-orientedmodelsreflectscompilerandprogrammerconvenience,ratherthancommon-senseunderstandings(LaLonde&Pugh1991).Ifthereisanacceptancethatlogicsareformalisationsofcommon-senseunderstandings,thenforthepurposesoftransparency(ortranslucency)ratherthanprogramming,theidealwouldbethatthemodelstructureisrepresentedusingaxiomsofdescriptionlogics.

1.3 Semanticdifferencesbetweenclassicalobject-orientedprogramminglanguagesanddescriptionlogicshavebeenhighlightedbyPolhillandGotts(2009),withreferencetoLalondeandPugh's(1991)distinctionsamongthethreeinheritancerelationssubtype,subclassandis-a.Ofthesethree,thefirstisforcompilerconvenienceincheckingtypesinvolvedinoperations(interfacesinJava),thesecondforprogrammerconvenienceinfacilitatingcodere-use(classesinJava),whilstthethirdreflectsdescriptive,logicalmeaningsthatareofprimaryinterestfromanontologicalpointofview.Thesedifferencesmeanthatdirectontologylearningfrommodelsourcecodeisnotguaranteedinobject-orientedprogramminglanguages.

http://jasss.soc.surrey.ac.uk/18/2/15.html 1 20/10/2015

Page 2: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

1.4 Netlogo(Wilensky1999)modelsdonothavetheseissuesbecauseNetlogoisnotanobject-orientedprogramminglanguage,andthereisnoinheritanceamongthelanguage'smainentity('agent'inNetlogoterminology)types,whichareknownas'breeds'.Thefacilityforexplicitrepresentationofrelationships(or'links')amongagents,ratherthanencapsulatingassociationsinclassesasinobject-orientedlanguages,furthercontributestoenablingautomaticontologylearningfromNetlogomodelcode,though,asdiscussedlater,doingsoimposesaparticularprogrammingstyleontheimplementation.

1.5 Netlogo'sextensionfacilityenablessoftwaretobewrittenthatprovidesfunctionalityfromwithinNetlogotoautomaticallyextractanOWL(Horrocksetal.2003)orOWL2(CuencaGrauetal.2008)ontologyfromthemodel.OWLisapopularlyusedlanguageforexpressingontologies,whichhascorrespondenceswithdescriptionlogicsthatdependonthesublanguageused.ThemappingisshowninTable1.

Table1:MappingfromNetlogosyntaxtoOWLontologytypes.

Netlogosyntax OWLtype(s) Commentsbreed Class BreedsinNetlogo,likeclassesinOWL,arenotnecessarilydisjoint–

agentscanchangebreedusingthesetbreedcommand.directed-link-breed(no'own')

ObjectProperty Foralllinkbreeds,thereisnosyntaxtoconstrainthebreedsofagentthatareateitherendofthelink,meaningthatdomainsandrangesforlinkscannotbeinferredfromthecode.Ifthelinkbreeddoesnothaveanyofits'own'variables,itcanbedeclareddirectlyasanobjectproperty…

directed-link-breed(with'own')

ClassandObjectProperty

…otherwisethelinkmustbereified,andtwoobjectpropertiesusedtolinkthebreedsthatcanbeconnectedinthisway.Theobjectpropertygoingintotheclassrepresentingthepropertycanbedeclaredinversefunctional;theobjectpropertygoingoutcanbedeclaredfunctional.ApropertychaincanbeusedtorepresentthelinkasawholeiftheontologyisinOWL2.

undirected-link-breed

ObjectPropertyorClassandObjectProperty

Inadditiontothepointsapplyingtodirectedlinkbreeds,objectpropertiescorrespondingtoundirectedlinkbreeds(inthecaseofreifiedlinks,thiswillapplytothechain)canbedeclaredsymmetricinOWL.IftheontologyisinOWL2,alllinkscanbedeclaredasirreflexiveasNetlogodoesnotpermitanagenttolinktoitself.

breeds-own DataProperty Thedomainofthedatapropertycanbedeclaredtobetheclasscorrespondingtothebreed.However,sinceNetlogodoesnothavetypedvariables,thedatarangecannotbeautomaticallyinferred.Notethatdifferentbreedscanhavethesamevariable.

link-breeds-own

DataProperty Thedomainofthedatapropertycanbedeclaredtobetheclasscorrespondingtothelinkbreed.Notethatdifferentlinkbreedscanhavethesamevariable,butavariablecannotbesharedbetweenlinkbreedsandbreeds.

agent Individual AgentsinNetlogocanbeassertedasindividuals,andmembersoftheclasscorrespondingtothebreedofwhichtheyarecurrentlyamember.

1.6 Intherestofthispaper,anextensiontoNetlogoimplementingthesemappingsispresented,togetherwithanillustrationbasedontheCEDSS(CommunityEnergyDemandSocialSimulator)model,builtaspartoftheGILDED(Governance,Infrastructure,LifestyleDynamicsandEnergyDemand)FrameworkProgramme7project(http://gildedeu.hutton.ac.uk/).

TheNetlogoExtension

2.1 TheowlextensiontoNetlogowaswrittentoimplementthemappingsinTable1.TheextensioniswrittenforNetlogo5.0,andconsistsofthefileowl.jar.This,togetherwithversion3.1.0oftheOWL-API(Bechhoferetal.2003;Horridgeetal.2007;http://owlapi.sourceforge.net/),whichisavailableundertheGNULibraryGeneralPublicLicence,shouldbeplacedinasubdirectorynamed'owl'ofthedirectoryinwhichthe.nlogofileusingtheowlextensionislocated.Thefile'owl.zip'–thereleaseversionoftheextension,containsowl.jarandtheOWL-API(owlapi-bin.jar),readyforuse.Topermanentlyinstalltheextension,putitintheextensionsfolderoftheNetlogoapplicationsdirectory.

2.2 TheextensionmakesavailableanumberofcommandstoaNetlogomodelcontainingthefollowingcommand(typically,nearthebeginningofthecode):

extensions[owl]

Thecommandsaregiveninapproximateorderinwhichtheymustoccurduringexecutionofthemodel.Specifically,

http://jasss.soc.surrey.ac.uk/18/2/15.html 2 20/10/2015

Page 3: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

owl:domain,owl:rangeandowl:importscannotbeusedafterowl:model,andowl:structureandowl:statemayonlybeusedafterowl:model.

2.3 Thecommandsassumeadistinctionbetweenthestructureandthestateofthemodelandcorrespondingontologies.Anontologydescribingthestructureofamodelconsistsofterminology(T-box)axiomsdescribingthekindsofentitythatthemodelcontains(OWLclasses),propertiestheyhave(OWLdataproperties)andrelationshipstheymayhavewithothertypesofentity(OWLobjectproperties).Bycontrast,anontologydescribingthestateofamodelappliestoaparticularsnapshotofaninstanceofitrunningatonetime.Thestateontologyimportsthestructureontology,andthenaddsassertion(A-box)axiomsaboutthespecificinstancesofthevariousclassesofentitythatexistinthemodelwhenthesnapshotistaken.

owl:domainlink-breedbreed

2.4 Theowl:domaincommandtakestwoarguments.Thefirstisthe(string)nameofalink-breed,andthesecondisthe(string)nameofabreed.ThecommandcausesanassertiontobemadeintheontologythattheOWLclasscorrespondingtothebreedisinthedomainoftheOWLobjectpropertycorrespondingtothelink-breed.

2.5 Thiscommandwillnotaffectyourmodel(thatistosay,whilethemodelruns,nocheckwillbemadeofthelink-breedthatonlyagentsofthespecifiedbreedareinthedomainofthelink-breed).

owl:rangelink-breedbreed

2.6 Theowl:rangecommandtakestwoarguments.Thefirstisthe(string)nameofalink-breed,andthesecondisthe(string)nameofabreed.ThecommandcausesanassertiontobemadeintheontologythattheOWLclasscorrespondingtothebreedisintherangeoftheOWLobjectpropertycorrespondingtothelink-breed.

2.7 Justasforowl:domain,owl:rangedoesnotcauseanycheckstobemadewhilethemodelrunsthatonlyagentsofthespecifiedbreedareintherangeofthelink-breed.

owl:importsIRI…

2.8 Theargument(s)totheowl:importscommandarestringscontainingInternationalisedResourceIdentifiersforontologiesthatthemodelstructureontologyistoimport.Again,thisdoesnotaffectthemodelinanyway,orcauseanycheckstobemade,butallowstheontologytobecreatedwiththeimportsinplacereadyforusewithontologyvisualisation,reasoningandanalysistools.

owl:modelIRI

2.9 DefinetheInternationalisedResourceIdentifierforthemodelstructureontology,whichiscontainedinthestringargument.AllontologieshaveanIRI,whichconstitutesanidentifierfortheontology.AlthoughtheIRIisusuallyawebaddress,itisnotnecessarilythecasethatthefilewillexistatthatwebaddress(thoughideallyitwould)–theIRIisjustaname.

2.10 Asstatedabove,allowl:domain,owl:rangeandowl:importscommandsmustexecutebeforeowl:modelisexecuted,andnoowl:structureorowl:statecommandmayexecuteuntilowl:modelhasexecuted.

owl:optionsoption-string…

2.11 Setoptionsforcreatingstructureandstateontologies.Threeoptionstringsareavailable:

"owl2",whichwilladdOWL2axiomstotheontologywhererelevant;"relations",whichwilladdaxiomsassertingrelationshipattributes(e.g.symmetric,andif"owl2"isspecified,irreflexiveandasymmetric)topropertyassertionsintheontologywhererelevant;and"no-patches",whichsuppressesspatialaxioms.SpatialaxiomsincludetheassertionofalocationobjectpropertywithrangePatch,andhencethedeclarationofthelatterasaclass.

Theoption"none"(thedefault)canbeusedtoindicatethatnoneoftheoptionsaboveapplies.Theowl:optionscommandcanberunmorethanonce,overridinganyoptionsselectedinearliercalls;subsequentcallstoowl:structureandowl:statewillrespecttheoptionsselected.

owl:structurefile-name

2.12 Saveamodelstructureontologytothefilenamegivenasarguments.ThelogicalIRIoftheontologywillbethatspecifiedusingtheowl:modelcommand.NotethatforvisualisationsoftwaresuchasOntoViztoshowalinkasanobjectpropertyintheresultingdiagram,bothowl:domainandowl:rangemusthavebeenspecified.(Thesoftwarewouldotherwisenotknowwhichclassestodrawthelinkfromandtorespectively.)

owl:statefile-nametime-step(experimental)

http://jasss.soc.surrey.ac.uk/18/2/15.html 3 20/10/2015

Page 4: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

2.13 Saveanontologyofthecurrentstateofthemodeltothefilename.ThelogicalIRIforthestateontologywillbeconstructedfromthemodelIRIspecifiedbytheearlierowl:modelcommandandthetime-stepgivenassecondargumenttothiscommand.Specifically,any.owlsuffixwillberemovedfromthemodelIRI,andthen"-state-"appended,followedbythetime-step,followedbytheextensionstringifgiven,followedbythe.owlsuffixifthemodelIRIhaditoriginally.

2.14 Forexample,themodelIRI"http://www.gildedeu.org/ontologies/CEDSS-3.3.owl"giventheargument7forthetime-step,wouldproduceastateontologyIRI"http://www.gildedeu.org/ontologies/CEDSS-3.3-state-7.owl".(Notethatthelinkshavedifferenttargetsfromthoseshown.)

2.15 Thefile-nameargumentgivesaphysicallocationtosavetheontologyto.Ifitdoesnotendwith".owl",thenthenameoftheresourceinthegeneratedstateontologyIRIisappendedtothefile-nameargumenttoproducethefinallocation.Forexample,withthestateontologyIRIabove(ifticks=7):

owl:state"/var/tmp/"ticks

willsavetheontologyto/var/tmp/CEDSS-3.3-state-7.owl.

2.16 Anexceptionisthrownifanattemptismadetooverwriteanexistingfile.

2.17 Theowl:statecommandcanbequitedemandingonresourcesdependingonthesizeofthemodel.Aswellasthefilesavedbeingpotentiallyquitelargeinsize,thecommandcantakeseveralminutestosearchthroughalltheelementsinthemodel,andmaycrashwithheaperrorsifNetlogoisnotrunwithsufficientmemorygiventotheJavavirtualmachine.(TheexampleinFigure3belowtakes1minuteorsoonamachinewitha2.8GHzIntelCorei7processor,requires8GofRAMfortheJavavirtualmachine,andtheresultingOWLfile(inRDF/XMLformat)occupies650Morsoofdiskspaceifnotcompressed.)

Illustration

3.1 TheCEDSS(CommunityEnergyDemandSocialSimulator)modelwasbuilttosimulatedomesticenergyusepatternsinasmallcommunity(e.g.ahousingestateoravillage),andisbasedonanearlierprototypemodelwiththeacronymABMED(AgentBasedModelofEnergyDemand;Gotts2009).Itrepresentshouseholdsasagents,wholiveindwellings,andhaveaportfolioofappliancestheyuseforspaceandwaterheating,andentertainment.Usingarepresentationofthepsychologicaltheoryof'goalframes'(Lindenberg&Steg2007),inwhichconsumerdecisionsarebasedarounddifferentmodesofbehaviour(inthiscase,hedonistic,egoistic,andbiospheric),CEDSSagentsdecidehowtoreplacebrokenappliances,andwhethertobuyanynewappliances.Interactionsarebasedaroundagentsvisitingotherhousesintheirsocialnetwork.Visitoragentsobserveandpotentiallydesireappliancestheydon'townthattheirhostspossess,andadjustgoalframeparameterstomaketheprobabilitiesofdifferentmodesofbehaviourmoresimilartothoseoftheirhosts.

3.2 ThefollowingproceduredemonstratestheuseofsomeoftheaboveontologyfeaturestosaveastructureontologyfromCEDSS:

Figure1.ExampleproceduretoextractastructureontologyfromCEDSS.

3.3 UsingtheOntoViz(Sintek2007)plug-inforProtégé3,aDOTgraphcanbecreatedoftheresultingontology,which(withsomeminoreditingtosimplifythetext,enterdatatypesandhighlightreifiedlink-breedsinblue)isshowninFigure2.

http://jasss.soc.surrey.ac.uk/18/2/15.html 4 20/10/2015

Page 5: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

Figure2.OntologyextractedfromCEDSSvisualisedwithOntoViz.

Figure3.DiagramofalltheindividualsinastateontologyintheCEDSSmodel,renderedusingthesfdpcommandsuppliedwithGraphViz[1]andabespokeprogramtocreateanappropriatelyformatteddotgraphfromtheontology.Nodes(blackdots)areindividuals,colouredarcsareobjectproperties.Apartfromthedensegraphinthemiddle,theotherarcsshowupgrade

http://jasss.soc.surrey.ac.uk/18/2/15.html 5 20/10/2015

Page 6: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

pathsforinsulations,andlocation(built-inrelationshipagentshavewithpatches,whichwouldnothavebeenincludediftheno-patchesoptionhadbeenspecified).

Discussionandconclusion

4.1 WhilsttheontologyextractedfromtheNetlogocodemakessemanticsense,writinganewmodelwithaviewtousingtheextensionmayaffectthewaycertainconceptsarerepresented.Thetreatmentofallbreeds''own'variablesasdatapropertiesmeansthatanysuchvariablesthatcontainlistsorsetsofotheragentswillnotberepresentedasarelationshipintheresultingstructureontology,withtheextensionaspresentlywritten.Theeffectwouldbetoencouragetheexplicitrepresentationofrelationshipsusinglink-breeds.MappingfrombreedstoOWLclasseswouldalsoencouragemodeldeveloperstomakegreateruseofbreedsformodelentitiesthanotherwisetheymight.An'agent'mightnormallybethoughtofassomethingthatundertakesanaction,aconceptualisationthattendstoopposetherepresentationofinanimateentitiesasagents.ThismaybeundesirablefromsometheoreticalperspectivesiftheconceptofanagentinNetlogoistobetakenliterally(aviewthatwouldarguablybesomewhat'fundamentalist'incharacter),butisnotwithouttheoreticalprecedent(Dennett1971;Latour2005).

4.2 Theothersideofthiscoinisthatdifferentcodingstyleswillinfluencetheontologyextracted.SupposetwopeopleuseNetlogotoreimplementthesamemodel.Bothreimplementationsbehaveinthesameway(orwithadegreeofsimilaritycorrespondingtooneofWilenskyandRand's(2007)levels),butthedifferentapproacheachhasusedtorepresentthemodelusingNetlogodatastructuresandfeaturesmeansthattheontologiesextractedfromeachimplementationwillbedifferent.

4.3 Hereweusethesimpleexampleofamodelinwhichagroupofchildrenareplayingwithtoys.Eachchildhasatoy,and,dependingonwhichtoytheyhavewillgetboredwithitafteraspecifiednumberoftimestepsandtrytoswaptheirtoywiththatofoneoftheirfriendswhoisalsobored.Thereareconstraintsonwhichtoyscanbeswapped(seeTable2).Thenumberoftimestepsforwhicheachchildhasthetoytheyareplayingwithisrecorded,andisresettozeroaftereachswap.Theparametersofthemodelarethepercentagesofchildrenhavingeachtoyinitially,thenumberofchildren,andthenumberoffriendseachchildhas(whichisthesameforallchildren).Weareinterestedinthedistributionofthenumberofboredchildrenoverthetimeofthemodelrun,whichisahistogramofthenumberoftimestepsforwhichtherewerexboredchildren.

Table2:Tableoftoyparameters

Toy Timeuntilbored Canswapwith…marbles 3 blocks,bearblocks 4 marbles,bearbear 2 marbles,blocks,rag-dollrag-doll 1 bear

4.4 Therearevariouswaysthemodelcouldbeimplemented,buttohighlightthepotentialdifferencesincodingstyle,wechooseoneapproachmakingnouseofbreedsorlinks,andcontrastitwithacodingstylemoresuitableforusewiththeowlextension.Thetwoimplementationshaveslightlydifferentoutputafter500timesteps–exactnumericalsimilarity,despitecontrollingforseed,hasnotbeenachieved,butthedistributionsofnumbersofboredchildrenovertimeareverysimilar(Figure4).InFigure5,however,thedifferencebetweentheontologiestheextensionisabletoextractfromthetwoimplementationsisclear.

(a)(b)

Figure4.Screenshotsfromthetwoimplementationsusingthesameparameters.(a)Implementationnotusingbreedsorlinks;(b)implementationsuitableforowlextension(whichisalsoabletoshowwhoisplayingwithwhichtoy).After500time

steps,thedistributionsofboredchildrenshowninthehistogramsaresimilar,butthereareslightdifferences.

http://jasss.soc.surrey.ac.uk/18/2/15.html 6 20/10/2015

Page 7: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

(a)(b)

Figure5.Differenceinontologygeneratedbytheowlextensionforthetwoimplementations.(b)Showstheontologyfromtheimplementationdesignedtoworkwiththeowlextension.NotethatincontrasttoFigure2,thereifiedrelationshipPlayingshasnotbeencoloured,anddatatypeshavenotbeenmanuallyentered.Thisshowsmoreclearlywhattheowlextension

providesbydefault.

4.5 AsTable3shows,thereareconsiderabledifferencesinthewaytherepresentationinthetwoimplementationsissetup.Theleftcolumnrepresentationjustusesthedefaultturtlebreedandassignsitsomevariablestostoretheinformationusedbythemodel:alistoffriends,whichtoytheyareplayingwith,whetherornottheyarebored,andthelengthoftimetheyhavebeenplayingwiththecurrenttoy.Intherighthandcolumn,thecodeismoreexplicitaboutthemicroworld:therearebreedsfortoysandchildren,linkbreedsforwhoisafriendofwhom,whoisplayingwithwhattoy,andwhichtoyscanbeswappedwithwhichothers.Asaresult,thechildrenbreedhasonlytheBooleanstoringwhetherornottheyarebored.Therighthandrepresentationalsocontainsadditionalinformationaboutthetoys,withboredom-timestoringhowlongittakesforachildtogetboredwithplayingwithit.ThecodeinTable4showsthatthestrictimplementationnotusingabreedtorepresentthetoyshasmeantthatthisinformationishard-codedintothemodel,thoughtherecouldbewaysroundthisusing,forexample,thetableextensioninNetlogotoassociatethenameofthetoywiththetime.

Table3:Contrastingrepresentationsinthetwoimplementationsofthe'toy'model

Nobreedsorlinks Versionsuitableforowlextensionturtles-own[friendstoybored?time]

breed[toystoy]toys-own[nameboredom-time]

breed[childrenchild]children-own[bored?]

directed-link-breed[friendsfriend]

directed-link-breed[playingsplaying]playings-own[time]

undirected-link-breed[swapsswap]

Table4:Contrastingimplementationofdeterminingwhetherchildrenarebored

http://jasss.soc.surrey.ac.uk/18/2/15.html 7 20/10/2015

Page 8: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

4.6 Table4alsoshowsthattherecanbesomeawkwardsyntaxinthecodingstyleusedtomaketherepresentationinthemodelmoresuitablefortheowlextension.SinceNetlogodoesn'thavesyntaxforfunctionalrelationships,my-out-playingsmakesitunclearthateachchildcanonlyplaywithonetoyatatime.Arguably,forthosenotfamiliarwithNetlogo,thecodeontheleftisclearerabouttheconditionsunderwhichchildren(eveniftheyarecalledturtleshere)becomebored.Ontheotherhanditmakesnoreferenceto'playing'or'boredom-time',meaningthatforthosewithanunderstandingofNetlogosyntax,thecodeontherightis(functionalrelationshipquestionaside)arguablymoretransparentinthatthehardcodednumbersarereplacedwithavariabledescribingwhattheyaresupposedtomean.

4.7 Althoughthefactthatthesetwofunctionallysimilarimplementationshavedifferentontologiescouldbeseenasaweakness,itcouldequallybearguedthatthisisareflectionofvariationsintransparencyofcodingstyle.Thatis,twofunctionallysimilarimplementationscanstillbecomparedonthebasisofhowclearlytheirsourcecodereflectsthesystemtheyarerepresenting.WhetherthisextensiontoNetlogohasanyroletoplayinmakingsuchajudgementisdebatable,if,indeed,suchquestionsareanythingmorethanamatterofsubjectivepreferences.Insofarasthereareobjectivemeasuresoftransparency(anexampleofwhichcouldbetheeasewithwhichinferencescanbemadeusinginformationaboutthemodelstateorstructure),softwaresuchastheNetlogoextensionpresentedherecouldproveuseful.

AvailabilityandRequirements

ThesoftwareisavailableonGitHubunderaGNULesserGeneralPublicLicenceathttps://github.com/garypolhill/netlogo-owl.

ItrequirestheOWL-APIversion3.1.0availablefromSourceForgeathttp://sourceforge.net/projects/owlapi/files/OWLAPI(forOWL2.0)/3.1.0/.

Acknowledgements

ThisworkwasfundedbytheEuropeanCommissionSeventhFrameworkProgramme,grantagreementnumber225383,andtheScottishGovernmentRuralAffairsandtheEnvironmentPortfolioStrategicResearchTheme4(EconomicAdaptation).

Notes

1http://www.graphviz.org/

References

BECHHOFER,S.,Volz,R.&Lord,P.(2003).CookingthesemanticwebwiththeOWLAPI.InFensel,D.,Sycara,K.&Mylopoulos,J.(eds.)SecondInternationalSemanticWebConference,ISWC2003,SanibelIsland,Florida,20–23October2003.LectureNotesinComputerScience2870,659–675.[doi:10.1007/978-3-540-39718-2_42]

CUENCAGRAU,B.,Horrocks,I.,Motik,B.,Parsia,B.,Patel-Schneider,P.&Sattler,U.(2008).OWL2:ThenextstepforOWL.JournalofWebSemantics6,309–322.[doi:10.1016/j.websem.2008.05.001]

DENNETT,D.C.(1971).Intentionalsystems.TheJournalofPhilosophy68(4),87–106.[doi:10.2307/2025382]

http://jasss.soc.surrey.ac.uk/18/2/15.html 8 20/10/2015

Page 9: Extracting OWL Ontologies from Agent-Based Modelsjasss.soc.surrey.ac.uk/18/2/15/15.pdf · an OWL (Horrocks et al. 2003) or OWL 2 (Cuenca Grau et al. 2008) ontology from the model

GALÁN,J.M.,Izquierdo,L.R.,Izquierdo,S.S.,Santos,J.I.,delOlmo,R.,López-Paredes,A.&Edmonds,B.(2009).Errorsandartefactsinagent-basedmodelling.JournalofArtificialSocietiesandSocialSimulation12(1),1:http://jasss.soc.surrey.ac.uk/12/1/1.html

GOTTS,N.(2009).ABMED:Aprototypemodelofenergydemand.SixthConferenceoftheEuropeanSocialSimulationAssociation,UniversityofSurrey,Guildford,Surrey,14–18September2009.

HORRIDGE,M.,Bechhofer,S.&Noppens,O.(2007).IgnitingtheOWL1.1touchpaper:TheOWLAPI.ProceedingsoftheThirdOWLExperienceandDirectionsWorkshop,OWLED2007,Innsbruck,Austria,June2007.

HORROCKS,I.,Patel-Schenider,P.F.&vanHarmelen,F.(2003).FromSHIQandRDFtoOWL:ThemakingofaWebOntologyLanguage.JournalofWebSemantics1,7–26.[doi:10.1016/j.websem.2003.07.001]

JANSSEN,M.,Alessa,L.N.,Barton,M.,Bergin,S.&Lee,A.(2008).Towardsacommunityframeworkforagent-basedmodelling.JournalofArtificialSocietiesandSocialSimulation11(2),6:http://jasss.soc.surrey.ac.uk/11/2/6.html

LALONDE,W.&Pu,J.(1991).Subclassing≠subtyping≠is-a.JournalofObject-OrientedProgramming3(5),57–62.

LATOUR,B.(2005).ReassemblingtheSocial–AnIntroductiontoActor-Network-Theory.OxfordUniversityPress.

LEYDESDORFF,L.(2001).Technologyandculture:Thedisseminationandthepotential'lock-in'ofnewtechnologies.JournalofArtificialSocietiesandSocialSimulation4(3),5:http://jasss.soc.surrey.ac.uk/4/3/5.html

LINDENBERG,S.&Steg,L.(2007).Normative,gainandhedonicgoalframesguidingenvironmentalbehavior.JournalofSocialIssues,63(1),117-137.[doi:10.1111/j.1540-4560.2007.00499.x]

POLHILL,J.G.&Gotts,N.M.(2009).Ontologiesfortransparentintegratedhuman-naturalsystemsmodelling.LandscapeEcology24(9),1255–1267.[doi:10.1007/s10980-009-9381-5]

SINTEK,W.(2007).OntoViz.Availablefromhttp://protegewiki.stanford.edu/index.php/OntoViz.

TAYLOR,R.I.(2003).Agent-basedmodellingincorporatingqualitativeandquantitativemethods:Acasestudyinvestigatingtheimpactofe-commerceuponthevaluechange.Ph.D.Thesis,CentreforPolicyModelling,ManchesterMetropolitanUniversity.CPMReportNo.CPM-03-137.http://cfpm.org/cpmrep137.html

WILENSKY,U.(1999).Netlogo,http://ccl.northwestern.edu/netlogo/.CenterforConnectedLearningandComputer-BasedModelling,NorthwesternUniversity,Evanston,IL.

WILENSKY,U.&Rand,W.(2007).Makingmodelsmatch:Replicatinganagent-basedmodel.JournalofArtificialSocietiesandSocialSimulation10(4),2:http://jasss.soc.surrey.ac.uk/10/4/2.html

http://jasss.soc.surrey.ac.uk/18/2/15.html 9 20/10/2015