java - OWL API - Store a Class to which an Individual belongs rather than printing it -


entitysearcher.gettypes(individual, ontology) returns stream of owlclassexpression.

to print do:

 entitysearcher.gettypes(individual, ontology).foreach(system.out::println); 

instead want store output in owlclass or set of owlclass deal later. how do that?

the stream operations confusing me.

sincere regards

to turn stream set, there's utility in owlapistreamutils::asset(stream) - convenience around standard collectors class.

to owlclass only, need filter types:

set classes = owlapistreamutils.asset( entitysearcher.gettypes(individual, ontology) .filter(owlclassexpression::isowlclass));


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -