Possible that there are multiple matches, but unlikely :) In that case I
just need any one of them.

InfModel is only used for this case. I don't see how I can avoid it. If say
I want to find an instance of foaf:Document or its subclasses, just looking
at the raw model such as

    :instance a my:Class .

is not enough, because it doesn't know whether my:Class is a subclass of
foaf:Document or not, without adding schema. That is why I'm using InfModel.

On Sat, Dec 2, 2017 at 6:31 PM, ajs6f <[email protected]> wrote:

> Is it possible in your use case that there is more than one of these guys,
> or do you have reason to assume that if there is one, it is unique? If
> there is more than one, do you need to produce all examples? Is this the
> only use of the inference model (IOW could you do the inference in a
> different way) or do you need other inference facilities and therefore the
> InfModel is really required?
>
> ajs6f
>
> > On Dec 2, 2017, at 12:27 PM, Martynas Jusevičius <[email protected]>
> wrote:
> >
> > Hi,
> >
> > what would be the most effective way to find a Resource that
> > - belongs to a raw Model
> > - in an instance of class X in an InfModel (which is based on the Model
> > above)
> > ?
> >
> > I came up with something which iterates instances and filters by
> membership
> > (lambda syntax not tested):
> >
> > infModel.listSubjectsWithProperty(RDF.type, class).
> >    filterKeep(r -> infModel.getRawModel().containsResource(r))
> >
> > If a lot of instances were inferred in the InfModel, I can see this being
> > slow.
> >
> > Is there a better way? Maybe inversing the iterations somehow?
> >
> >
> > Martynas
>
>

Reply via email to