For the sake of being consistent with my initial post, where I thought
that the function works in one machine and not in another:

Here's the quick test of the ontology with all the classes, functions
and properties. it;s quite simplified since i tested this in a
separate project before i integrated it in the "serious" one.

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns:spin="http://spinrdf.org/spin#";
    xmlns:sp="http://spinrdf.org/sp#";
    xmlns:smf="http://topbraid.org/sparqlmotionfunctions#";
    xmlns="http://foo.co.uk/un#";
    xmlns:owl="http://www.w3.org/2002/07/owl#";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
    xmlns:tops="http://www.topbraid.org/tops#";
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
    xmlns:spl="http://spinrdf.org/spl#";
  xml:base="http://foo.co.uk/un";>
  <owl:Ontology rdf:about="">
    <owl:versionInfo rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
    >Created with TopBraid Composer</owl:versionInfo>
    <owl:imports rdf:resource="http://spinrdf.org/spin"/>
  </owl:Ontology>
  <owl:Class rdf:ID="role">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/
owl#Thing"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    ></rdfs:label>
  </owl:Class>
  <owl:Class rdf:ID="feature">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/
owl#Thing"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    ></rdfs:label>
  </owl:Class>
  <rdf:Property rdf:ID="value">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/
>
    <rdfs:domain rdf:resource="#feature"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >value</rdfs:label>
  </rdf:Property>
  <rdf:Property rdf:ID="hasFeature">
    <rdfs:range rdf:resource="#feature"/>
    <rdfs:domain rdf:resource="#role"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >has feature</rdfs:label>
  </rdf:Property>
  <rdf:Property rdf:ID="relation">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/
>
    <rdfs:domain rdf:resource="#feature"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >relation</rdfs:label>
  </rdf:Property>
  <spin:Function rdf:ID="getFeatureValues">
    <rdfs:subClassOf rdf:resource="http://spinrdf.org/spin#Functions"/
>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >Functions_1</rdfs:label>
    <spin:body>
      <sp:Select>
        <sp:resultVariables rdf:parseType="Collection">
          <rdf:Description rdf:about="http://spinrdf.org/spin#_arg1"/>
          <rdf:Description rdf:nodeID="A0">
            <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
            >r</sp:varName>
          </rdf:Description>
          <rdf:Description rdf:nodeID="A1">
            <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
            >v</sp:varName>
          </rdf:Description>
        </sp:resultVariables>
        <sp:where rdf:parseType="Collection">
          <rdf:Description>
            <sp:object rdf:resource="#feature"/>
            <sp:predicate rdf:resource="http://www.w3.org/1999/02/22-
rdf-syntax-ns#type"/>
            <sp:subject rdf:resource="http://spinrdf.org/spin#_arg1"/>
          </rdf:Description>
          <rdf:Description>
            <sp:object rdf:nodeID="A0"/>
            <sp:predicate rdf:resource="#relation"/>
            <sp:subject>
              <rdf:Description rdf:nodeID="A2">
                <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
                >o</sp:varName>
              </rdf:Description>
            </sp:subject>
          </rdf:Description>
          <rdf:Description>
            <sp:object rdf:nodeID="A1"/>
            <sp:predicate rdf:resource="#value"/>
            <sp:subject rdf:nodeID="A2"/>
          </rdf:Description>
        </sp:where>
      </sp:Select>
    </spin:body>
  </spin:Function>
  <rdf:Description rdf:ID="Thresholds">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    ></rdfs:label>
  </rdf:Description>
  <spin:Function rdf:ID="additionOfPreqs">
    <spin:constraint>
      <spl:Argument>
        <spl:predicate rdf:resource="http://spinrdf.org/sp#arg1"/>
      </spl:Argument>
    </spin:constraint>
    <spin:body>
      <sp:Select>
        <sp:resultVariables rdf:parseType="Collection">
          <rdf:Description>
            <sp:expression>
              <sp:Sum>
                <sp:expression rdf:parseType="Resource">
                  <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
                  >value</sp:varName>
                </sp:expression>
              </sp:Sum>
            </sp:expression>
            <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
            >sum</sp:varName>
          </rdf:Description>
        </sp:resultVariables>
        <sp:where rdf:parseType="Collection">
          <sp:Let>
            <sp:expression>
              <tops:foreach>
                <sp:arg1>
                  <getAllFeaturesOfObject>
                    <sp:arg1 rdf:resource="http://spinrdf.org/
spin#_arg1"/>
                  </getAllFeaturesOfObject>
                </sp:arg1>
              </tops:foreach>
            </sp:expression>
            <sp:variable>
              <rdf:Description rdf:nodeID="A3">
                <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
                >f</sp:varName>
              </rdf:Description>
            </sp:variable>
          </sp:Let>
          <rdf:Description>
            <sp:object rdf:resource="#feature"/>
            <sp:predicate rdf:resource="http://www.w3.org/1999/02/22-
rdf-syntax-ns#type"/>
            <sp:subject rdf:nodeID="A3"/>
          </rdf:Description>
          <sp:Let>
            <sp:expression>
              <isSatisfied>
                <sp:arg1 rdf:nodeID="A3"/>
              </isSatisfied>
            </sp:expression>
            <sp:variable rdf:parseType="Resource">
              <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
              >value</sp:varName>
            </sp:variable>
          </sp:Let>
        </sp:where>
      </sp:Select>
    </spin:body>
    <rdfs:subClassOf rdf:resource="http://spinrdf.org/spin#Functions"/
>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >Functions_1</rdfs:label>
  </spin:Function>
  <role rdf:ID="Role1">
    <hasFeature>
      <feature rdf:ID="feature2">
        <rdfs:label rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >feature2</rdfs:label>
        <relation rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >more</relation>
        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#double";
        >1</value>
      </feature>
    </hasFeature>
    <hasFeature>
      <feature rdf:ID="feature1">
        <relation rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >less</relation>
        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#double";
        >1</value>
        <rdfs:label rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >feature1</rdfs:label>
      </feature>
    </hasFeature>
  </role>
  <spl:Argument rdf:nodeID="A4">
    <spl:predicate rdf:resource="http://spinrdf.org/sp#arg1"/>
  </spl:Argument>
  <rdf:Description rdf:nodeID="A5">
    <rdf:rest rdf:parseType="Collection">
      <rdf:Description>
        <sp:object rdf:parseType="Resource">
          <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
          >v</sp:varName>
        </sp:object>
        <sp:predicate rdf:resource="#value"/>
        <sp:subject>
          <rdf:Description rdf:nodeID="A6">
            <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
            >o</sp:varName>
          </rdf:Description>
        </sp:subject>
      </rdf:Description>
    </rdf:rest>
    <rdf:first rdf:parseType="Resource">
      <sp:object rdf:parseType="Resource">
        <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >r</sp:varName>
      </sp:object>
      <sp:predicate rdf:resource="#relation"/>
      <sp:subject rdf:nodeID="A6"/>
    </rdf:first>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A7">
    <sp:object>
      <rdf:Description rdf:nodeID="A8">
        <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
        >v</sp:varName>
      </rdf:Description>
    </sp:object>
    <sp:predicate rdf:resource="#value"/>
    <sp:subject rdf:resource="http://spinrdf.org/spin#_arg1"/>
  </rdf:Description>
  <sp:Select rdf:nodeID="A9">
    <sp:resultVariables rdf:parseType="Collection">
      <rdf:Description rdf:nodeID="A6"/>
    </sp:resultVariables>
    <sp:where rdf:parseType="Resource">
      <rdf:rest rdf:nodeID="A5"/>
      <rdf:first rdf:parseType="Resource">
        <sp:object rdf:nodeID="A6"/>
        <sp:predicate rdf:parseType="Resource">
          <sp:varName rdf:datatype="http://www.w3.org/2001/
XMLSchema#string"
          >p</sp:varName>
        </sp:predicate>
        <sp:subject rdf:resource="http://spinrdf.org/spin#_arg1"/>
      </rdf:first>
    </sp:where>
  </sp:Select>
  <rdf:Description rdf:nodeID="A10">
    <rdf:first rdf:nodeID="A7"/>
    <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-
ns#nil"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A11">
    <sp:object rdf:resource="#feature"/>
    <sp:predicate rdf:resource="http://www.w3.org/1999/02/22-rdf-
syntax-ns#type"/>
    <sp:subject rdf:resource="http://spinrdf.org/spin#_arg1"/>
  </rdf:Description>
  <sp:Select rdf:nodeID="A12">
    <sp:resultVariables rdf:parseType="Collection">
      <rdf:Description rdf:nodeID="A8"/>
    </sp:resultVariables>
    <sp:where rdf:parseType="Resource">
      <rdf:rest rdf:nodeID="A10"/>
      <rdf:first rdf:nodeID="A11"/>
    </sp:where>
  </sp:Select>
  <spl:Argument rdf:nodeID="A13">
    <spl:predicate rdf:resource="http://spinrdf.org/sp#arg1"/>
  </spl:Argument>
  <spin:Function rdf:ID="isSatisfied">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >Functions_1</rdfs:label>
    <rdfs:subClassOf rdf:resource="http://spinrdf.org/spin#Functions"/
>
    <spin:constraint rdf:nodeID="A4"/>
    <spin:body rdf:nodeID="A12"/>
  </spin:Function>
  <spin:Function rdf:ID="getAllFeaturesOfObject">
    <spin:constraint rdf:nodeID="A13"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
    >Functions_1</rdfs:label>
    <rdfs:subClassOf rdf:resource="http://spinrdf.org/spin#Functions"/
>
    <spin:body rdf:nodeID="A9"/>
  </spin:Function>
</rdf:RDF>

<!-- Created with TopBraid -->

I tried SPARQL running:

select ?p where {
LET(?p:=:additionOfPreqs(:Role1))
}

on the two machines, in one it returns 2.0e0 (which is what i want)
and in the other i get the same error.

I am using the tops:foreach in exactly the same manner
SELECT ((SUM(?value)) AS ?sum)
WHERE {
    LET (?f := tops:foreach(:getAllFeaturesOfObject(?arg1))) .
    ?f a :feature .
    LET (?value := :isSatisfied(?f)) .
}

and no matter how much I try to understand what is different I can't
seem to solve this.

Many thanks and sorry for the lengthy posts.
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