1

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.

2
  • 1
    This isn't a question. Commented Oct 19, 2013 at 20:58
  • 1
    not sure? => REPL. But what you have should "do it". Don't believe me? => REPL. Commented Oct 19, 2013 at 23:36

2 Answers 2

1

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))
Sign up to request clarification or add additional context in comments.

1 Comment

additionally, if you (import '(com.hp.hpl.jena.rdf.model ModelFactory)) first, you can use the def form in the original code unchanged
0

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

(ClassName/methodName arguments) 

Have you tried your line in the REPL any way?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.