Play Project Setup in IntelliJ ( Play + Java)


, , ,

1. Tips:

Install your play framework in directory name without white space:

2. Creating a New Project

To create a new project in Play you need to follow the following steps:

1. Open CMD and go to your play installation directory.


2. Create a new play Project and continue with option and Have fun!


Now, the project is created. Our next task is to make the project available in Intellij IDE.

3. Installing Play Plugin in Intellij

Before we open the project in Intellij, we need to add Play2.0 plugin in Intellij. Notice that, intellij already has Play1.0 plugin.

It can be done from the settings menu under file Menu or from Intellij open dialog.


1. Select Configure and then Select Plugins


2. Click on Install JetBrains Plugin: Select Play 2.0 support and Scala Support and Install



4. Making Project in Intellij

1. Go to your newly created Project Folder in CMD: cd TestPlayProject

2. Type in CMD : play idea


3. Now open the project in Intellij


Now we have our project opened in Intellij.


5. Creating Build Configuration in Intellij

1. Go to Run Menu and Select Edit Configuration and Click on “+” Button


2. Select Play 2 App and name the Build Configuration


6. Creating Build Configuration in Intellij

Now we will add required modules. We can see there is some error in the projects:


Here I will add two example modules, Scala and JPA.

To Add Modules:

1. Go to File Menu and the Project Structure Menu:


2. Click on the “Modules” and Select “+” to add Modules: Scala and Java


For Scala, add Language Level and Compiler Library. For JPA select Hibernate or suitable Provider. Then click apply.

3. Now We can compile the project. For first compile we need to compile the project in CMD. Type: Play Compile


4. Now We can Run the Project without any Error : Type : play run


5. To Test Project Run : go to browser and type url : http://lcoalhost:9000



1. If there is any error in framework, use command : Play clean-all

Reading Ontology With OWL: IMPORT using JENA


, , , , , , , ,

If we want to read an ontology that also import another ontology ( have an OWL: IMPORT), both the ontology URI has to resolve.

But, most of the time we may need to load both the ontology from file system. The default JENA “read” method will process the ontology automatically and try to resolve the Import ontology when it read the base ontology.

Let, we have the following ontology import statement in our base ontology:

<Ontology rdf:about=””>
      <imports rdf:resource=””/>

Now, If we read the base ontology from our file system, clearly the imported ontology URI will not get resolved. This will result exception reading the ontology.

We can solve the problem using JENA provided OntDocumentManager and FileManager classes. OntDocumentManager let us use a policy file which can be defined in rdf.  In this policy rdf we can define our import ontology file as OntologySpec and OntDocumentManger can resolve the relative url of the imported ontology automatically.

You could find an example ont-policy file in your JENA download directory at : …./etc/ont-policy.rdf

Now, we will follow the following steps:

1) Create a Ont-Policy file and add our import ontology reference there.

2) Read our Base ontology file

This should automatically load both the ontology without any error.

1) Adding the Ont-Policy File: In our source folder or any other location of convenience.


Now add an OntologySpec node containing the relative url of the import ontology/ontologies

    <!– local version of the OWL language ontology (in OWL) –>
    <publicURI rdf:resource=”” />
    <!– uncomment the following line to re-direct attempts to http get the file–>
   <altURL    rdf:resource=”file:./src/PatientOntology.rdf”/>
    <language  rdf:resource=”” />
    <prefix    rdf:datatype=”&xsd;string”>PO</prefix>

We may add more of OntologySpec Node as the number of imports in File.

2) Now we can read the file using following method:

public static void ReadOntologyWithImport() {
    //Set document manager policy file
    OntDocumentManager dm = new OntDocumentManager(“file:./src/ont-policy.rdf”);
    OntModelSpec modelSpec = PelletReasonerFactory.THE_SPEC;
    OntoModel  ontModelWithImport = ModelFactory.createOntologyModel(modelSpec);

//Read the base Ontology File ; Here its SmdWithImport“./src/SmdWithRule.rdf”), NS);

NOW YOUR ONTOLOGY should be in the OntModel without any exception with imported ontology. Cheers.! Smile


There are few other work around.

1) If you don’t want to use document manager, you must make sure the url resolve:

One way of doing that is to create a server (may be in your localhost) and store ontologies there and read.

2) Use setProcessImport(false) and remove import statement from ontology. Then you can read the import files and add the model to the base model.

3) We can use the document manager and add OntologySpec using Jena Programmatically.

Also, there is way to programmatically add  Imports programmatically.


You can see the JENA ontology API documentation for more details.

Continue reading

Installing RavenDB as Service


, , , ,


For fewdays I was playing with RavenDB, a document database developed in C# supporting Linq. So, as developed in .NET, you can use it as .NET managed code other than MongoDB APIs. 

To Install as service, Download Latest build of RavenDB, from here: RavenDB Download

Extract the file in a folder. Now Open the command prompt: RUN >> CMD.

1. GO to the your RavenDB Folder and go to Server Directory.

2. Type: Raven.Server.exe /install.

3. Now you should have RavenDB installed as service.

You can view the service in your service listing using: Run> Services.msc

To Uninstall: go to the Server diretory and type: Raven.Server.exe /uninstall.


In addition, RavenDB also provide a management console called STUDIO. As you installed, you can go to the console :RavenBD STUDIO

1. There you can generate sample data to play with the feature.