Hi Adam,

As indicated previously SPIN / Custom Inferencing functionality is a Virtuoso 8 
commercially license product feature and not available in the Virtuoso open 
source product this mailing list is targeted at. Thus using the commercial 
product you should log an online support case with us, where the issue can be 
picked up by one of our consultants at:

        http://support.openlinksw.com/support/online-support.vsp

Also, I don’t understand the rule you are seeking to create as a rectangle 
cannot have a volume, so you are  calculating the area as width * height  , and 
then multiplying area * height to get volume, which is incorrect, as you would 
need to depth (or length) to calculate the volume of a cube ie box effectively 
? Or are you just using this to demonstrate the chaining of rule results being 
sought ?

BTW, running your scripts I don’t get the error you report, as both the first 
one wich runs completion without error, although volume is not returned, thus 
what is the version of Virtuoso 8 being used, which can be obtained by running 
the command the the “bin” directory of your installation:

        ./virtuoso-iodbc-t -?

The second script gives error:

         Error SPINX: VD [Virtuoso Server]SPIN graph top-level subject 
http://example.org/shapes#rs1 is of unsupported rdf:type 
http://www.w3.org/1999/02/22-rdf-syntax-ns#Property

To get your first script to run  changed the rule to:

SPARQL 
PREFIX shapes: <http://example.org/shapes#> 
PREFIX spin:    <http://spinrdf.org/spin#>
PREFIX sp: <http://spinrdf.org/sp#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

WITH <urn:spin:rule:geometry:lib> 
INSERT {
          shapes:Solid 
        rdf:type  owl:Class;
        rdfs:label "Solid class";
        spin:rule [
                   a sp:Construct;
                   sp:text """ 
                               CONSTRUCT { ?this 
<http://example.org/shapes#area> ?area }
                               WHERE {
                                       {
                                           SELECT ?this (xsd:float(?height) * 
xsd:float(?width)) AS ?area
                                           WHERE { 
                                                       ?this 
<http://example.org/shapes#width> ?width ; 
                                                             
<http://example.org/shapes#height> ?height . 
                                                 } 
                                       }
                                       }
                          """
                  ] ;
        spin:rule [
                   a sp:Construct;
                   sp:text """ 
                               CONSTRUCT { ?this 
<http://example.org/shapes#volume> ?volume }
                               WHERE {
                                       {
                                           SELECT ?this (xsd:float(?height) * 
xsd:float(?height) *  xsd:float(?width)) AS ?volume
                                           WHERE { 
                                                       ?this 
<http://example.org/shapes#width> ?width ; 
                                                             
<http://example.org/shapes#height> ?height . 
                                                 } 
                                       }
                                       }
                          """
                  ] .
        } 

Done. -- 5 msec.

-- Line 109: EXEC ('SPARQL ' || 
SPARQL_SPIN_GRAPH_TO_DEFSPIN('urn:spin:rule:geometry:lib'))

Done. -- 200 msec.

-- Line 115:
SPARQL

DEFINE input:macro-lib <urn:spin:rule:geometry:lib>
PREFIX shapes: <http://example.org/shapes#>

SELECT *
FROM <http://geometry>
WHERE
    {
        ?s a shapes:Solid ;
           shapes:area  ?area ;
           shapes:volume ?volume .
    } 
s                                                                               
  area                                                                          
    volume
LONG VARCHAR                                                                    
  LONG VARCHAR                                                                  
    LONG VARCHAR
_______________________________________________________________________________

http://example.org/shapes#solid_1                                               
                                   245                                          
                                        1225

1 Rows. -- 16 msec.
SQL>

Which is essentially what your first script is seeking to do, but  ?area from 
the first rule does not seem to be available to the second rule as it has not 
been evaluated it seems, which is what you seem to be hoping it will as part of 
a chain ?

Although as said you should log an online support case for this issue ....

Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.      //              http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers



> On 1 Sep 2018, at 22:04, Adam Sanchez <a.sanche...@gmail.com> wrote:
> 
> Hi all,
> 
> I have tried to chain two rules in Virtuoso 8 for testing.
> The steps are described in this link.
> 
> https://gist.github.com/asanchez75/93ff4079819022bcd2cf42d4ec6bc335
> 
> The SPIN rules must compute the volume of an instance of the class
> Solid in two chained "steps":
> a) given the width and the height computes the area
> b) the area computed previously is multiplied by the height (again) to
> compute the volume finally.
> 
> When I run the query, I got this message
> 
> Virtuoso 37000 Error SP031: SPARQL compiler: The name
> ?area_urn_spin_rule_geometry_lib_bnode_b10021_19 is used in multiple
> clauses, without any logical connection
> 
> SPARQL query:
> 
> #output-format:text/html
> define sql:signal-unconnected-variables 1 define
> sql:signal-void-variables 1 define input:default-graph-uri
> <http://geometry> DEFINE input:macro-lib <urn:spin:rule:geometry:lib>
> PREFIX shapes: <http://example.org/shapes#>
> 
> SELECT *
> FROM <http://geometry>
> WHERE
>    {
>        ?s a shapes:Solid ;
>           shapes:area  ?area ;
>           shapes:volume ?volume .
>    }
> 
> I have tried to use the property spin:nextRuleProperty to chain the
> two rules here
> 
> https://gist.github.com/asanchez75/1dc1424753065b5fa7153963af6dd8b2
> 
> but it does not work
> 
> Any idea on this?
> 
> Best,
> 
> Adam
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to