Sofia; I think the issue here lies somewhere between modeling and
querying the model.  I.e. good modeling can simplify how you query the
data.  I believe Holger is correct that there is no need for
tops:foreach here.  In addition, I think what you are looking for may
be possible using a simple SPARQL graph match.

I'm still not entirely clear on what you are trying to accomplish, so
I'm making some conjectures that I hope you find useful.  Let's start
simple with this part of your question:

> For example, I wan to decide if an object O has all its features'
> values >0. As I mentioned before I am not sure how many features O
> has.

As an example for how SPARQL performs iterative matches, you can query
all resources (objects) for certain properties.  In this case, I'm not
clear what you mean by "all its features", but given the model you
sent I'm assuming that you mean that each resource has a set
of :hasFeature properties, and their values must be >0.0.  This can be
done with the SPARQL query:

SELECT ?p ?value
WHERE
{  ?s :hasFeature ?feature .
   ?feature :value ?value .
   FILTER (?value > 0.0)
}

It's not clear to me, BTW, that the extra indirection is needed.
E.g., an example of your model is the following:
  :Role1 :hasDoubleFeature :feature1 .
  :feature1 :value 1 .

Without further requirements to  abstractthe values of :hasFeature,
this could be more clearly modeled directly, e.g.:
  :Role1 :hasFeature 1 .

BTW, I'd suggest that your :value (my :hasDoubleFeature) should be a
owl:DatatypeProperty with range of xsd:Double.

This will give you all properties (?p) that have a value greater than
0.0 .  I assume what you really want is the "inverse" - find all
property values where the value does not meet you criteria.  You can
query by changing the query to FILTER (?value <= 0.0).

Using SPIN Constraints would be really useful in this case.  This will
get you a constraint warning whenever your constraints are violated.
There are three steps:

1) Import spin.rdf into your model (drag/drop TopBraid/SPIN/ into
Imports tab of model)  I see that in your model, you've already done
this.

2) Insert the following query into the spin:constraints property for a
class definition (:role in your model, I believe):
# value of :hasFeature must be > 0.0
ASK WHERE {
    ?this :hasFeature ?feature .
    ?feature :value ?value .
    FILTER (?value <= 0.0) .
}

(?this is a reserved variable name - the only one in TBC - that gets
pre-bound to each member of the class before running the query).  The
query will raise a constraint violation warning any where the resource
(instance of the class the constraint is defined in, and all
subClassOf entailments) is less than zero.

3) Turn on Constraint violation warnings (yellow warning triangle in
the top button bar of Composer) and navigate to the resources
(objects) you want to look at.  Or, open the Windows > Show View >
Problems view and click refresh.  A list of clickable warnings will
appear.

Given all of this, your issue may be more complex, but I first wanted
to make sure we're at a common starting point  From here, perhaps we
can frame the problem in a common language and give you something to
work with.

-- Scott


On Jun 3, 7:58 pm, sofiangeletou <[email protected]> wrote:
> Hi Scot,
> thanks for your replies :)
> The example you gave me works, however I don't know which are the
> objects over which i will have to iterate, these will be given by
> another function. For example:
>
> If I create a function (subclass of spin:Functions)
> kennedys:getTheKennedys
> with body:
> SELECT ?r
> WHERE {
>     ?r a ?arg1 .}
>
> and argument :Argument sp:arg1 : kennedys:Person
>
> and I then SPARQL call
>
> SELECT ?x
> WHERE {
>    let(?x:= tops:foreach (kennedys:getTheKennedys(kennedys:Person)))
>
> }
>
> I will get the same error. Something tells me that what I am trying to
> do is not what foreach is meant (?!!)
>
> I am not trying to make a plugin, I am trying to create a highly
> parameterised framework where for each object I don't know neither the
> name, the value, nor the number of attributes.
>
> For example, I wan to decide if an object O has all its features'
> values >0. As I mentioned before I am not sure how many features O
> has. So what I have done is:
> a. created a function that counts the number of features of O.
> b. created a function that given each feature F checks if  F>0. if yes
> it returns 1 otherwise 0.
> c. [here i get the problem] when i iterate/aggregate over the values
> of all F I want to compare their sum against the count i obtained from
> a.
> do i make any sense?
>
> Yes I would greatly appreciate if you could help me with the sparql's
> triple match.
> Many thanks!!
> Sofia
>
> On Jun 4, 1:02 am, Scott Henninger <[email protected]> wrote:
>
> > I'm not able to reproduce this yet, so some additional detail will be
> > necessary.  To make sure we're on the same page, try the query in the
> > Help files for tops:foreach.  Open TopBraid/Examples/kennedys.rdf and
> > copy the following query into the SPARQL view:
> > SELECT *
> > WHERE {
> >     ?x tops:foreach (kennedys:Gender kennedys:College kennedys:Person
> > kennedys:Profession)
>
> > }
>
> > (BTW, tops:for each is rarely used - in most cases SPARQL's triple
> > match will do what is necessary - it already has a "for each" built
> > in.  Ask if that doesn't make sense.)
>
> > If you are trying something else, please let us know.  Are you trying
> > to build a Java plug-n extension?
>
> > -- Scott
>
> > On Jun 3, 6:36 pm, sofiangeletou <[email protected]> wrote:
>
> > > Hi Scott,
>
> > > I get the same problem on a fresh installation of tbc 3.5.
>
> > > Warning
> > > Sat Jun 04 00:34:12 BST 2011
> > > WARN [Thread-17] (E_Function.java:70) - URI <http://www.topbraid.org/
> > > tops#foreach> has no registered function factory
>
> > > Am I missing something obvious? :(
> > > Thanks for your help
> > > Sofia
>
> > > On Jun 4, 12:11 am, sofiangeletou <[email protected]> wrote:
>
> > > > Hi Scott,
> > > > thanks for your advice. I tried to update TBC using eclipse but got
> > > > the following error.
> > > > Your original request has been modified.
> > > >   "TopBraid Composer Free Edition" is already installed, so an update
> > > > will be performed instead.
> > > > Cannot complete the install because of a conflicting dependency.
> > > >   Software being installed: TopBraid Composer Free Edition
> > > > 3.5.0.v20110530-0330R (org.topbraidcomposer.free.feature.group
> > > > 3.5.0.v20110530-0330R)
> > > >   Software currently installed: TopBraid Composer FE
> > > > 3.3.1.v20100423-1816R (org.topbraidcomposer.free
> > > > 3.3.1.v20100423-1816R)
> > > >   Only one of the following can be installed at once:
> > > >     TopBraid Composer SPIN Plug-in 3.5.0.v20110530-0330R
> > > > (org.topbraidcomposer.spin 3.5.0.v20110530-0330R)
> > > >     TopBraid Composer SPIN Plug-in 3.3.1.v20100423-1816R
> > > > (org.topbraidcomposer.spin 3.3.1.v20100423-1816R)
> > > >   Cannot satisfy dependency:
> > > >     From: TopBraid Composer FE 3.3.1.v20100423-1816R
> > > > (org.topbraidcomposer.free 3.3.1.v20100423-1816R)
> > > >     To: org.topbraidcomposer.free.feature.group
> > > > [3.3.1.v20100423-1816R]
> > > >   Cannot satisfy dependency:
> > > >     From: TopBraid Composer Free Edition 3.3.1.v20100423-1816R
> > > > (org.topbraidcomposer.free.feature.group 3.3.1.v20100423-1816R)
> > > >     To: org.topbraidcomposer.spin [3.3.1.v20100423-1816R]
> > > >   Cannot satisfy dependency:
> > > >     From: TopBraid Composer Free Edition 3.5.0.v20110530-0330R
> > > > (org.topbraidcomposer.free.feature.group 3.5.0.v20110530-0330R)
> > > >     To: org.topbraidcomposer.spin [3.5.0.v20110530-0330R]
>
> > > > I will try to download and install it separately. By the way, I didn't
> > > > reuse the project from one computer to the other, was only doing
> > > > simple sparql queries. I will let you know how i get on with updating.
> > > > Many thanks
> > > > Sofia
>
> > > > On Jun 3, 10:51 pm, Scott Henninger <[email protected]>
> > > > wrote:
>
> > > > > Sofia; The issue does seem to be with a mismatch of the registered
> > > > > system files.  For upgrading Composer, 
> > > > > seehttp://www.topquadrant.com/products/TBS_FAQ.html#TBS3,
> > > > > in particular the last paragraph explains how to re-use a workspace
> > > > > created with a different version of Composer.  Basically, delete the
> > > > > projects named 'TopBraid' and 'server.topbraidlive.org' and re-start
> > > > > Composer.
>
> > > > > We did have some issues with Eclipse update manager some time ago.  It
> > > > > could be easiest to install a fresh copy of TBC.  Install files for
> > > > > the latest version of Composer (3.5) is found 
> > > > > athttp://www.topquadrant.com/products/TB_install.php, and if you need
> > > > > 3.4.4, you can find it 
> > > > > athttp://www.topquadrant.com/products/download/3.4.4/.
>
> > > > > -- Scott
>
> > > > > On Jun 3, 3:54 pm, sofiangeletou <[email protected]> wrote:
>
> > > > > > Dear all,
> > > > > > I have been using the tops:foreach on my laptop TBC (3.3.1) without 
> > > > > > a
> > > > > > problem but when I am trying to use it on my desktop TBC (3.4.4) I 
> > > > > > get
> > > > > > the following warning which of course does not allow me to proceed
> > > > > > with my functions.
>
> > > > > > "<http://www.topbraid.org/tops#foreach> has no registered function
> > > > > > factory"
>
> > > > > > In my help topics I saw that I should be able to extend topbraid 
> > > > > > using
>
> > > > > > org.topbraid.sparql.propertyFunctions
> > > > > > (com.hp.hpl.jena.sparql.pfunction.PropertyFunction)
>
> > > > > > but I am not sure if this should be already in TBC or how to install
> > > > > > it. In the installed packages I only see installed
>
> > > > > > org.topbraid.sparql
> > > > > > org.topbraid.sparqlmotion.Functions
> > > > > > org.topbraid.sparqlmotion
>
> > > > > > and there is no available software for installation in TopBraid
> > > > > > Composer -http://www.topquadrant.com/products/updates/3.4/. Unless I
> > > > > > have to use another update site. I am not sure how to proceed so I
> > > > > > would appreciate a lot your help.
>
> > > > > > Many thanks,
> > > > > > sofia

-- 
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

Reply via email to