1

I'm new to Jena, but when I look at the vocabularies defined with the Jena source (i.e. in directory: jena-2.10.0-Source\jena-core\src\main\java\com\hp\hpl\jena\vocabulary) I see some of the vocabularies create properties and resources using 'ResourceFactory.createProperty()' (e.g. OWL2.java, RDF.java, RDFS.java), whereas others in the same directory use 'ModelFactory.createDefaultModel().createProperty()' (e.g. DC_11.java, VCARD.java, DCTerms.java).

I understand that ResourceFactory is used to create resources and properties without reference to a 'model', but I just want to understand why some of these vocabs choose to create and use a 'model' instance while others choose not to.

Is it just personal style, or is one approach generally recommended over the other (maybe one style is an 'old approach', as I understand Jena has been around a long time)?

I'd like to use both the RDFS and DC_11 vocabs with my code, and obviously define my own app-specific resources and properties, so I'm just trying to understand which approach I should adopt for my own stuff.

1 Answer 1

1

That both styles are used is just historical accident. I think these days, I'd probably suggest using the ResourceFactory approach, simply because it avoids the (small) overhead of allocating a model, and the model gives you no real advantages. At some point, we'll probably go back and do some refactoring to just use a single approach in the Jena codebase.

5
  • Cool - thanks Ian, that was exactly what I was looking for! I guessed the reason might be historical, and I was leaning towards the 'ResourceFactory' approach myself anyway, so thanks a million for taking the time to verify that for me :) Jul 18, 2013 at 9:48
  • If you feel your question is answered, you can notify future SO readers with the same enquiry of that fact by ticking the check-mark next to your preferred answer. Jul 18, 2013 at 10:05
  • Yeah, I know Ian, but my reputation is only '6'(!), and you need 15 to Up-Vote - sorry! Jul 23, 2013 at 16:15
  • No, you misunderstand. You can accept an answer by ticking the checkmark next to the question so that it goes green. It's different from up-voting, and will increase your reputation too! Jul 23, 2013 at 22:25
  • @PatMcBennett You should accept this answer, and now that you've got enough reputation, you could upvote it too. Sep 6, 2013 at 16:40

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.