Creating your first story
This section shows the creation of a simple story called Hello my Lord. The source code of this story comes together with the distribution and can be found in the dgiovanni/src/stories/helloMyLord/ package.
Starting the story
After downloading DGiovanni, the simplest way to start the Hello my Lord story is:
or
Creating a new project
For the creation of a new story the first thing to be done is the creation of its ontology. For this, in the following example, it will be used the NeOn Toolkit ontology engineering environment (http://neon-toolkit.org/wiki/Main_Page). First, a new project must be created. In this case, its name will be HelloMyLord.
Importing the DGiovanni's ontologies
The next step is to import the DGiovanni's archTbox.owl and archAbox.owl from dgiovanni/src/dgiovanni/ontology/ directory.
Creating one ontology for the story
Create a new ontology and add the ontology identifier (e.g. http://dgiovanni.sourceforge.net/stories/ontology/HelloMyLord) and the default namespace (e.g. http://dgiovanni.sourceforge.net/stories/ontology/HelloMyLord#).
The HelloMyLord ontology must import the DGiovanni's archAbox.
Now create the individuals for the classes. For the HelloMyLord story the following individuals have been created:
- Character class
- Servant
- Data property: aslFilename — build/stories/helloMyLord/asl/servant.asl — string
- Data property: classFilename — dgiovanni.core.StoryCharacter — string
- Player
- Data property: aslFilename — build/stories/helloMyLord/asl/player.asl — string
- Data property: classFilename — dgiovanni.core.StoryCharacter — string
- Servant
- Setting class
- HelloMyLordSetting
- Data property classFileName — stories.helloMyLord.core.HelloMyLordSetting
- HelloMyLordSetting
- Scene class
- SceneI
- Data property: number — 1 — integer
- Data property: state — A room of state in the castle — string
- SceneI
- Act class
- ActI
- Object property: hasScene — SceneI
- Data property: number — 1 — integer
- ActI
- IncidentChooser class
- HelloMyLordDramaManager
- Data property: classFileName — stories.helloMyLord.core.HelloMyLordDramaManager— string
- HelloMyLordDramaManager
- Author class
- Myself
- Data property: name — Myself— string
- Yourself
- Data property: name — You yourself— string
- Myself
- Story class
- HelloMyLord
- Object property: hasAct — ActI
- Object property: hasAuthor — Myself
- Object property: hasAuthor — YouYourself
- Object property: hasSetting — HelloMyLordSetting
- Object property: hasGenre — Drama
- Object property: hasStyle — Interactive
- Object property: hasCharacter — Servant
- Object property: hasCharacter — Player
- Object property: hasIncidentChooser — HelloMyLordDramaManager
- Data property: aslFilename — build/stories/helloMyLord/asl/beat_sequencer_agent.asl — string
- Data property: initClassFilename — stories.helloMyLord.core.HelloMyLordStoryInitiator — string
- Data property: inputProcessorClassFilename — stories.helloMyLord.core.HelloMyLordInputProc — string
- HelloMyLord
Adding the new ontology to the configuration file
Now copy the created abox to its final location (e.g. dgiovanni/src/stories/helloMyLord/ontology/) and add it to the architecture's configuration file (dgiovanni/config.xml). In this case, the id is a string value used to define the story to be started, the attribute name keeps the name of the story, the iri relates to the full Internationalized Resource Identifier of the story's instance, the ontology refers to the location of story's owl file, and the attribute disposeOfReasonerAfterLoading indicates whether the OWL Reasoner that reasons over the "root" ontology (the user defined story abox) must be disposed of after the story loading. Indeed, if the attribute disposeOfReasonerAfterLoading is "false", it is possible to get a reference to the reasoner by means of the dgiovanni.core.system.SystemObjHolder class.
In the next figure it is possible to see how the IRI/URI of the story can be discovered .
Finally, now it is time to create the JAVA classes that are loaded through
reflection, and the asl files that contain the characters'
behaviors and where the beats are coded. As an example, see the source code of the Hello My Lord story that can be found in the
dgiovanni/src/stories/helloMyLord/ package.