On 17/01/17 14:55, Jos Lehmann wrote:
Hi Dave,
that's looks like what I need, except I don't know how to write it down. At the
moment I do
OntModel model = ModelFactory.createOntologyModel();
That includes RDFS level inference by default.
What should I write instead?
( Note: When trying:
OntModel model = ModelFactory.createOntologyModel(OntModelSpec spec, Model
base);
Java complains it can't resolve variables / recognize tokens. )
To create a vanilla OntModel with no initial data, no inference and no
other config tweaks then you could use:
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
If you already have a plain model that you want to wrap up as an
OntModel then use the two-argument constructor and pass that plain model
in as the base model.
If you configure a different sort of OntModel then see the details at:
https://jena.apache.org/documentation/ontology/#creating-ontology-models
Dave
-----Ursprüngliche Nachricht-----
Von: Dave Reynolds [mailto:[email protected]]
Gesendet: Dienstag, 17. Januar 2017 15:18
An: [email protected]
Betreff: Re: Listing only asserted propeties Vs filtering property lists
On 17/01/17 13:02, Jos Lehmann wrote:
Hi there
I am copying Classes and/or Instances as well as their properties from one
ontology to another.
To get the list of Classe and/or Instance properties from the source
ontology I use listProperties()
But this gives much more than I need: i.e. superproperties, as well as other
stuff, which clutters my copy ontology.
I have tried to filter out undesired properties by recursive while calls on
Next(), or by trying to find a cut-off in the property list. But these
solutions are not general enough.
I would like to just get the asserted properties when querying the source
ontology. Is that possible?
Sounds like you have an OntModel with inference, create one without inference
or access the baseModel (bypassing the inference).
In the absence of any inference then Resource#listProperties will just list the
asserted properties (irrespective of what type of property).
Dave