Vuk Stanković
Vuk Stanković

Reputation: 7954

Creating Java object from clojure

I'm trying to start with Apache Jena in Clojure, so I have added library to resources folder.

Now I want to create Jena Model.

In Java, it would be

Model model = ModelFactory.createDefaultModel();

I guess in Clojure it would be something like this

(def model (ModelFactory/createDefaultModel))

But I'm not sure about this. I guess this could work for String but I don't know if it would work for custom object.

Upvotes: 1

Views: 317

Answers (2)

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14187

indeed. with the following in your project.clj:

  [org.apache.jena/jena-arq "2.10.0"]

then you can use:

  (def model (com.hp.hpl.jena.rdf.model.ModelFactory/createDefaultModel))

Upvotes: 1

Chiron
Chiron

Reputation: 20245

Well the official way to deal with Java static methods is:

(ClassName/methodName arguments) 

Have you tried your line in the REPL any way?

Upvotes: 0

Related Questions