Yes, ApplyConstruct is designed for exactly this kind of use case.
I'm not sure this is all that good of an example, as any person can be
a parent. But let's give it a try. Just to demonstrate that the
ApplyConstruct method is flexible enough for the use case and in fact
can create any set of triples, let's say that you want to operate on
all triples from the parent except for a :birthDate property. The
ApplyConstruct query would be:
CONSTRUCT
{ ?person :parent ?parent .
?parent ?p ?o .
}
WHERE
{ ?person :parent ?parent .
?parent ?p ?o .
FILTER (?p != :birthDate)
}
And the rule to get the last name from the parent, operating on these
triples is:
CONSTRUCT { ?person :lastName ?lname .}
WHERE
{ ?person :parent ?parent .
?parent :lastName ?lname .
}
No "parent" would be harmed here. The key here is that the rule is
applied only to the triples specified in the first query. You can
modify this in any way possible in SPARQL - get all instances of a
class, all instances with a birth date before some year, etc.
A SELECT query isn't going to help much because rules and inferences
are applied to triples, not resource. Stated another way, the
equivalent of a "SELECT?resource" in the CheckConstraints module is:
CONSTRUCT {?resource ?p ?o}
WHERE {?resource ?p ?o}
..and you can do this for whatever resource, with whatever criteria,
you need.
-- Scott
On Oct 28, 12:41 pm, Dean Rzonca <[email protected]> wrote:
> Scott,
>
> This approach presents a problem for us. There are cases where we want
> to be able to apply inferencing rules to a single resource, but we
> need some of the context around the resource in order to do that
> inferencing accurately.
>
> For example, assume there is an inferencing rule that constructs a
> last name for a Person resource based on that Person's parent's last
> name. You don't want to infer any new triples for the parent Person,
> but you do need the triples surrounding the parent to be included in
> the graph being passed in to the ApplyTopSPIN module when doing
> inferencing for the child.
>
> In cases like this, it would be immensely helpful to have something
> like a selectQuery on the ApplyTopSPIN module. If you can think of
> another way to accomplish this, please let me know.
>
> Thanks
>
> On Oct 28, 12:15 pm, Scott Henninger <[email protected]>
> wrote:
>
> > Hello Dean; The ApplySPIN module will apply SPIN rules to the triples
> > passed into the module. Therefore you can use ApplyConstruct with
> > replace=true, FilerByConstruct, etc., to define the set of triples you
> > want TopSPIN to run against.
>
> > The ApplyConstruct module's replace property could need some
> > explanation here. ApplyConstruct takes the input triples and creates
> > a set of triples as specified in the CONSTRUCT clause of the query.
> > If replace is set to false (the default) the output of the
> > ApplyConstuct module is the union of the input triples and the
> > constructed triples. If replace is set to true, then only the
> > constructed triples are returned. The latter gives you a flexible way
> > of defining a subset of your data for further processing in the
> > script.
>
> > -- Scott
>
> > On Oct 28, 9:55 am, Dean Rzonca <[email protected]> wrote:
>
> > > We are looking for a way to use the ApplyTopSPIN SPARQLMotion module
> > > on only a certain portion of a graph.
>
> > > The CheckConstraints module has a selectQuery parameter that allows us
> > > to select only certain resources for constraint checking- is there a
> > > way to do something similar with ApplyTopSPIN?
>
> > > Any help is appreciated.
>
> > > Thanks,
> > > Dean
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en