-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment: initializing world from template #9
Comments
e.g. a directory I think we need a similar thing to work with Jena reasoners, e.g. I'm working at the moment on the logic "if the RDF type is of Building and the class Building is a subclass of mud:Locatable then the instance is also a mud:Locatable" (https://stackoverflow.com/questions/32670869/how-to-use-transitive-reasoner-with-jena) ... writing a rule file like in the SO answer clearly the reusable way to do it but I'm not sure how to have this deploy with the Java app to a relative directory that I can access at runtime @MattTennison does it make sense? Do you know to do this in a Java project? Are you interested in it? |
Ahh, do you mean replacing this block of code with something less...hardcoded? mud-jena/src/main/java/com/mackervoy/calum/mud/MUDApplication.java Lines 57 to 98 in 022c3f7
If so, I get what you're saying - pull that out into a separate file that gets loaded in dynamically. That feels like a good first step, but we'd probably want to take it further, and remove it from the code altogether, instead relying on a DB or something more permanent (so updates to the initial world state don't involve a fresh deployment of the code). Happy to take a closer look, sounds like an interesting problem 😄 Is it blocking the logic you're building right now? |
yeah definitely that's what the issue is about - but the first step to that I think is being able to deploy a file directory onto the Tomcat server alongside the WAR? We do store it in a DB (using Apache Jena's Triplestore/NoSQL database engine), but the init data here (for a demo) could be read from a turtle "template"/import file I think? And the second checkbox is about having the template/import file configured by the web.xml so that it can easily be changed/deployed with some other data. What do you think? |
Nah it's not blocking :) I think that we will need to deploy rules files to the server with the WAR for more complex/exciting inferences as part of describers and things (e.g. "I'm a Tottenham fan and so I can deduce that Millwall scarves are not to my taste"), but for inferring that "a Fish is also an animal" I can hardcode it in the meantime, or temporarily add another RDF property to the POST data as a workaround |
Gotcha! Okay, so we could have an example template in the codebase as it's own file, but we don't mandate people use it, or modify that specific file - rather they point to a different location at their version via the web.xml. Yeah, I can pick this up 😄 |
@MattTennison I'm not sure if the first task on this list is necessary? #34 If running the Java server is the responsibility of the application using Mud-Jena (particularly if the specifics of that - i.e. Tomcat - aren't a part of this repo), then we can assume that they will do their own template upload or use a URL from somewhere else on the web Then all we need to do is add some custom |
I suppose that the first task is still great if you've already done it, and we'd just want to move it to a mud-tomcat repository |
For the second task... I think that in Jersey/JAX-RS this is fairly straightforward: https://stackoverflow.com/questions/17324075/get-configuration-data-from-web-xml-when-using-a-jersey-servletcontainer I've already started doing this task for #23 so I could pick it up, we need to synchronise on this issue I think 😅 |
At the moment in
MUDApplication
a demo world is created on startup using hardcoded calls to the Jena API. I have in mind that we could instead pass a Turtle file through theweb.xml
and via that import the configured template into the world dataset. There may be a better design I'm overlookingweb.xml
- useful links https://psamsotha.github.io/jersey/2015/12/27/jersey-configuration-properties.html and https://stackoverflow.com/questions/17324075/get-configuration-data-from-web-xml-when-using-a-jersey-servletcontainerMUDApplication.initWorld()
and importing it into the triplestoreTODOs in code referencing this issue
The text was updated successfully, but these errors were encountered: