The difference in behavior is in line with the SPARQL specification

An INSERT DATA clause can only add concrete triples I.e. no blank nodes are
permitted

However an INSERT can add blank nodes because it functions more like a
CONSTRUCT, bear in mind that for each solution a fresh blank node is
generated.  So if you had an INSERT like so:

INSERT
{
  _:blank ?p ?o
}
WHERE
{
  ?s ?p ?o
}

You would get a new blank node for each solution to the WHERE clause I.e. it
is not the same blank node each time.

Rob

From:  Hugh Williams <[email protected]>
Date:  Wednesday, January 2, 2013 5:08 PM
To:  Alexey Zakhlestin <[email protected]>
Cc:  "[email protected]"
<[email protected]>
Subject:  Re: [Virtuoso-users] Blank nodes in INSERT DATA

> Hi Alexey,
> 
> The "insert data ..." syntax does indeed fail as you indicate:
> 
> SQL> sparql insert data into <http://sample1/> { _:genid1 <p> <o1a> };
> 
> *** Error 37000: [Virtuoso Driver][Virtuoso Server]SQ074: Line 1: SP031:
> SPARQL compiler: Blank node '_:genid1' is not allowed in a constant clause
> at line 12 of Top-Level:
> sparql insert data into <http://sample1/> { _:genid1 <p> <o1a> }
> SQL>
> 
> But the following syntax does insert successfully:
> 
> SQL> sparql insert in graph <http://sample1/> { _:genid1 <p> <o1a> };
> 
> Done. -- 4 msec.
> SQL> sparql select * from <http://sample1/> where {?s ?p ?o};
> s                
> p                
> o
> VARCHAR          
> VARCHAR          
> VARCHAR
> 
______________________________________________________________________________>
_
> 
> nodeID://b76978246
> p                
> o1a
> 
> 1 Rows. -- 1 msec.
> SQL>
> 
> even though the blank nodes are stored using the Virtuoso internal format.
> 
> I shall check with development why "insert data ..." does not work as I would
> expect both syntaxes to behave the same ...
> 
> 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 2 Jan 2013, at 16:12, Alexey Zakhlestin <[email protected]> wrote:
> 
>> Is it possible to use blank nodes in INSERT DATA statements?
>> 
>> Rumors tell, that spec allows it:
>> http://answers.semanticweb.com/questions/12342/is-it-possible-to-use-blank-no
>> de-in-sparql-insert-data-queries
>> 
>> I get this error:
>> Virtuoso 37000 Error SP031: SPARQL compiler: Blank node '_:genid1' is not
>> allowed in a constant clause
>> 
>> 
>> -- 
>> Alexey Zakhlestin
>> https://github.com/indeyets
>> 
>> 
>> 
>> 
>> 
>> 
>> 
----------------------------------------------------------------------------->>
-
>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
>> and much more. Keep your Java skills current with LearnJavaNow -
>> 200+ hours of step-by-step video tutorials by Java experts.
>> SALE $49.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122612
>> _______________________________________________
>> Virtuoso-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> 
> ------------------------------------------------------------------------------
> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and
> much more. Keep your Java skills current with LearnJavaNow - 200+ hours of
> step-by-step video tutorials by Java experts. SALE $49.99 this month only --
> learn more at: http://p.sf.net/sfu/learnmore_122612
> _______________________________________________ Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to