[tracker/sparql-update] Use printf positionned placeholders



commit 9ab4f4139a41658c64bc0a06c01e48d473530093
Author: Adrien Bustany <adrien bustany nokia com>
Date:   Mon Mar 14 13:28:55 2011 +0200

    Use printf positionned placeholders

 .../ipc/test-insert-or-replace.vala                |  108 ++++++++++----------
 1 files changed, 54 insertions(+), 54 deletions(-)
---
diff --git a/tests/functional-tests/ipc/test-insert-or-replace.vala b/tests/functional-tests/ipc/test-insert-or-replace.vala
index 67d9b32..c352721 100644
--- a/tests/functional-tests/ipc/test-insert-or-replace.vala
+++ b/tests/functional-tests/ipc/test-insert-or-replace.vala
@@ -9,7 +9,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> nco:hasAffiliation ?subject .
+  <contact_b:%1$d> nco:hasAffiliation ?subject .
   ?subject nco:hasPostalAddress ?object .
 }
 
@@ -19,7 +19,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> nco:hasAffiliation [ nco:org ?subject ] .
+  <contact_b:%1$d> nco:hasAffiliation [ nco:org ?subject ] .
   ?subject nco:hasPostalAddress ?object .
 }
 
@@ -29,7 +29,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> ?predicate ?resource .
+  <contact_b:%1$d> ?predicate ?resource .
 
   FILTER(?predicate IN (nao:hasProperty, nco:hasPostalAddress, ncal:anniversary,
                         ncal:birthday, nco:hasLocation, nco:hasAffiliation)) .
@@ -57,21 +57,21 @@ WHERE
 
 DELETE
 {
-  <tel:+4917212345%d> ?predicate ?object .
+  <tel:+4917212345%1$d> ?predicate ?object .
 }
 WHERE
 {
-  <tel:+4917212345%d> ?predicate ?object .
+  <tel:+4917212345%1$d> ?predicate ?object .
   FILTER(?predicate IN (nao:hasProperty, nco:phoneNumber)) .
 }
 
 DELETE
 {
-  <tel:+4916134567%d> ?predicate ?object .
+  <tel:+4916134567%1$d> ?predicate ?object .
 }
 WHERE
 {
-  <tel:+4916134567%d> ?predicate ?object .
+  <tel:+4916134567%1$d> ?predicate ?object .
   FILTER(?predicate IN (nao:hasProperty, nco:phoneNumber)) .
 }
 
@@ -84,21 +84,21 @@ DELETE
 WHERE
 {
   ?resource a nco:PhoneNumber .
-  FILTER(?resource IN (<tel:+4917212345%d>, <tel:+4916134567%d>)) .
+  FILTER(?resource IN (<tel:+4917212345%1$d>, <tel:+4916134567%1$d>)) .
 }
 
 DELETE
 {
   GRAPH <urn:uuid:08070f5c-a334-4d19-a8b0-12a3071bfab9>
   {
-    <contact_b:%d> ?predicate ?object .
+    <contact_b:%1$d> ?predicate ?object .
   }
 }
 WHERE
 {
   GRAPH <urn:uuid:08070f5c-a334-4d19-a8b0-12a3071bfab9>
   {
-    <contact_b:%d> ?predicate ?object .
+    <contact_b:%1$d> ?predicate ?object .
     FILTER(?predicate NOT IN (nco:contactLocalUID,nco:contactUID,rdf:type)) .
   }
 }
@@ -107,20 +107,20 @@ INSERT
 {
   GRAPH <urn:uuid:08070f5c-a334-4d19-a8b0-12a3071bfab9>
   {
-    <contact_b:%d> rdf:type nco:PersonContact .
-    <contact_b:%d> nco:contactLocalUID \"%d\" .
-    <contact_b:%d> nco:gender nco:gender-male .
+    <contact_b:%1$d> rdf:type nco:PersonContact .
+    <contact_b:%1$d> nco:contactLocalUID \"%1$d\" .
+    <contact_b:%1$d> nco:gender nco:gender-male .
 
-    <contact_b:%d> nco:photo <avatar:photo:sleeping-bonobo> .
-    <contact_b:%d> nco:video <avatar:video:crazy-banana> .
+    <contact_b:%1$d> nco:photo <avatar:photo:sleeping-bonobo> .
+    <contact_b:%1$d> nco:video <avatar:video:crazy-banana> .
 
-    <contact_b:%d> nco:nameHonorificPrefix \"Sir\" .
-    <contact_b:%d> nco:nameGiven \"Andre b %d\" .
-    <contact_b:%d> nco:nameFamily \"Andrews b %d\" .
+    <contact_b:%1$d> nco:nameHonorificPrefix \"Sir\" .
+    <contact_b:%1$d> nco:nameGiven \"Andre b %1$d\" .
+    <contact_b:%1$d> nco:nameFamily \"Andrews b %1$d\" .
 
     _:_Affiliation_Work000000001 rdf:type nco:Affiliation .
     _:_Affiliation_Work000000001 rdfs:label \"Work\" .
-    <contact_b:%d> nco:hasAffiliation _:_Affiliation_Work000000001 .
+    <contact_b:%1$d> nco:hasAffiliation _:_Affiliation_Work000000001 .
 
     _:_Organization_Resource000000004 rdf:type nco:OrganizationContact .
     _:_Affiliation_Work000000001 nco:org _:_Organization_Resource000000004 .
@@ -129,7 +129,7 @@ INSERT
 
     _:Affiliation_Home1 rdf:type nco:Affiliation .
     _:Affiliation_Home1 rdfs:label \"Home\" .
-    <contact_b:%d> nco:hasAffiliation _:Affiliation_Home1 .
+    <contact_b:%1$d> nco:hasAffiliation _:Affiliation_Home1 .
 
     <mailto:andre andrews com>  rdf:type nco:EmailAddress .
     _:Affiliation_Home1 nco:hasEmailAddress <mailto:andre andrews com> .
@@ -137,19 +137,19 @@ INSERT
 
     _:Affiliation_Other1 rdf:type nco:Affiliation .
     _:Affiliation_Other1 rdfs:label \"Other\" .
-    <contact_b:%d> nco:hasAffiliation _:Affiliation_Other1 .
+    <contact_b:%1$d> nco:hasAffiliation _:Affiliation_Other1 .
 
     <mailto:andre andrews meego com>  rdf:type nco:EmailAddress .
     _:Affiliation_Other1 nco:hasEmailAddress <mailto:andre andrews meego com> .
     <mailto:andre andrews meego com> nco:emailAddress \"andre andrews meego com\" .
 
-    <tel:+4917212345%d> rdf:type nco:VoicePhoneNumber .
-    _:Affiliation_Home1 nco:hasPhoneNumber <tel:+4917212345%d> .
-    <tel:+4917212345%d> nco:phoneNumber \"+4917212345%d\" .
+    <tel:+4917212345%1$d> rdf:type nco:VoicePhoneNumber .
+    _:Affiliation_Home1 nco:hasPhoneNumber <tel:+4917212345%1$d> .
+    <tel:+4917212345%1$d> nco:phoneNumber \"+4917212345%1$d\" .
 
-    <tel:+4916134567%d>  rdf:type nco:CellPhoneNumber .
-    _:Affiliation_Home1 nco:hasPhoneNumber <tel:+4916134567%d> .
-    <tel:+4916134567%d> nco:phoneNumber \"+4916134567%d\" .
+    <tel:+4916134567%1$d>  rdf:type nco:CellPhoneNumber .
+    _:Affiliation_Home1 nco:hasPhoneNumber <tel:+4916134567%1$d> .
+    <tel:+4916134567%1$d> nco:phoneNumber \"+4916134567%1$d\" .
 
     _:Affiliation_Home1 nco:url \"http://andrews.com/\"; .
 
@@ -166,21 +166,21 @@ INSERT
     _:Address_Resource5 nco:streetAddress \"Friedrichstrasse 105\" .
 
     _:Anniversary_Resource3 rdf:type ncal:Event .
-    <contact_b:%d> ncal:anniversary _:Anniversary_Resource3 .
+    <contact_b:%1$d> ncal:anniversary _:Anniversary_Resource3 .
     _:Anniversary_Resource3 ncal:uid \"11223344\" .
     _:Anniversary_Resource3 ncal:dtstart \"2007-05-05T00:00:00\" .
     _:Anniversary_Resource3 ncal:description \"Hochzeit\" .
     _:Anniversary_Resource3 ncal:categories \"Wedding\" .
 
-    <contact_b:%d> nie:generator \"addressbook\" .
-    <contact_b:%d> nco:hobby \"fishing\" .
+    <contact_b:%1$d> nie:generator \"addressbook\" .
+    <contact_b:%1$d> nco:hobby \"fishing\" .
 
     ?_Tag_Resource000000010 rdf:type nao:Tag .
-    <contact_b:%d> nao:hasTag ?_Tag_Resource000000010 .
+    <contact_b:%1$d> nao:hasTag ?_Tag_Resource000000010 .
     ?_Tag_Resource000000010 nao:prefLabel \"Knorke\" .
 
-    <contact_b:%d> nie:contentLastModified \"2010-05-04T09:30:00Z\" .
-    <contact_b:%d> nie:contentCreated \"2010-04-22T01:00:00Z\" .
+    <contact_b:%1$d> nie:contentLastModified \"2010-05-04T09:30:00Z\" .
+    <contact_b:%1$d> nie:contentCreated \"2010-04-22T01:00:00Z\" .
   }
 }
 ";
@@ -202,7 +202,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> nco:hasAffiliation ?subject .
+  <contact_b:%1$d> nco:hasAffiliation ?subject .
   ?subject nco:hasPostalAddress ?object .
 }
 
@@ -212,7 +212,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> nco:hasAffiliation [ nco:org ?subject ] .
+  <contact_b:%1$d> nco:hasAffiliation [ nco:org ?subject ] .
   ?subject nco:hasPostalAddress ?object .
 }
 
@@ -222,7 +222,7 @@ DELETE
 }
 WHERE
 {
-  <contact_b:%d> ?predicate ?resource .
+  <contact_b:%1$d> ?predicate ?resource .
 
   FILTER(?predicate IN (nao:hasProperty, nco:hasPostalAddress, ncal:anniversary,
                         ncal:birthday, nco:hasLocation, nco:hasAffiliation)) .
@@ -230,20 +230,20 @@ WHERE
 
 DELETE
 {
-  <tel:+4917212345%d> nao:hasProperty ?object .
+  <tel:+4917212345%1$d> nao:hasProperty ?object .
 }
 WHERE
 {
-  <tel:+4917212345%d> nao:hasProperty ?object .
+  <tel:+4917212345%1$d> nao:hasProperty ?object .
 }
 
 DELETE
 {
-  <tel:+4916134567%d> nao:hasProperty ?object .
+  <tel:+4916134567%1$d> nao:hasProperty ?object .
 }
 WHERE
 {
-  <tel:+4916134567%d> nao:hasProperty ?object .
+  <tel:+4916134567%1$d> nao:hasProperty ?object .
 }
 
 DELETE
@@ -255,21 +255,21 @@ DELETE
 WHERE
 {
   ?resource a nco:PhoneNumber .
-  FILTER(?resource IN (<tel:+4917212345%d>, <tel:+4916134567%d>)) .
+  FILTER(?resource IN (<tel:+4917212345%1$d>, <tel:+4916134567%1$d>)) .
 }
 
 DELETE
 {
   GRAPH <urn:uuid:08070f5c-a334-4d19-a8b0-12a3071bfab9>
   {
-    <contact_b:%d> ?predicate ?object .
+    <contact_b:%1$d> ?predicate ?object .
   }
 }
 WHERE
 {
   GRAPH <urn:uuid:08070f5c-a334-4d19-a8b0-12a3071bfab9>
   {
-    <contact_b:%d> ?predicate ?object .
+    <contact_b:%1$d> ?predicate ?object .
     FILTER(?predicate NOT IN (nco:contactLocalUID,nco:contactUID,rdf:type)) .
   }
 }
@@ -286,10 +286,10 @@ INSERT OR REPLACE
     <mailto:andre andrews meego com> a nco:EmailAddress ;
 			nco:emailAddress \"andre andrews meego com\" .
 
-    <tel:+4917212345%d> a nco:VoicePhoneNumber ; nco:phoneNumber \"+4917212345%d\" .
+    <tel:+4917212345%1$d> a nco:VoicePhoneNumber ; nco:phoneNumber \"+4917212345%1$d\" .
 
-    <tel:+4916134567%d> a nco:CellPhoneNumber ;
-			nco:phoneNumber \"+4916134567%d\" .
+    <tel:+4916134567%1$d> a nco:CellPhoneNumber ;
+			nco:phoneNumber \"+4916134567%1$d\" .
 
     _:Anniversary a ncal:Event ;
 			ncal:uid \"11223344\" ;
@@ -313,25 +313,25 @@ INSERT OR REPLACE
     _:Affiliation_Work a nco:Affiliation ; rdfs:label \"Work\" ;
 			nco:org _:_Organization_Resource ;
 			nco:hasPostalAddress _:Address_Resource2 ;
-			nco:hasPhoneNumber <tel:+4916134567%d> .
+			nco:hasPhoneNumber <tel:+4916134567%1$d> .
 
     _:Affiliation_Home a nco:Affiliation ; rdfs:label \"Home\" ;
 			nco:hasEmailAddress <mailto:andre andrews com> ;
-			nco:hasPhoneNumber <tel:+4917212345%d> ;
+			nco:hasPhoneNumber <tel:+4917212345%1$d> ;
 			nco:url \"http://andrews.com/\"; ;
 			nco:hasPostalAddress _:Address_Resource1 .
 
     _:Affiliation_Other a nco:Affiliation ; rdfs:label \"Other\" ;
 			nco:hasEmailAddress <mailto:andre andrews meego com> .
 
-    <contact:%d> a nco:PersonContact ;
-			nco:contactLocalUID \"%d\" ;
+    <contact:%1$d> a nco:PersonContact ;
+			nco:contactLocalUID \"%1$d\" ;
 			nco:gender nco:gender-male ;
 			nco:photo <avatar:photo:sleeping-bonobo> ;
 			nco:video <avatar:video:crazy-banana> ;
 			nco:nameHonorificPrefix \"Sir\" ;
-			nco:nameGiven \"Andre%d\" ;
-			nco:nameFamily \"Andrews%d\" ;
+			nco:nameGiven \"Andre%1$d\" ;
+			nco:nameFamily \"Andrews%1$d\" ;
 			nco:hasAffiliation _:Affiliation_Work ;
 			nco:hasAffiliation _:Affiliation_Home ;
 			nco:hasAffiliation _:Affiliation_Other ;
@@ -358,7 +358,7 @@ main( string[] args )
 
 	t1.start ();
 	for (i = 0; i < y; i++) {
-		c.update (insert_query_replace.printf (i, i, i, i, i, i, i, i, i, i));
+		c.update (insert_query_replace.printf (i));
 	}
 	t1.stop ();
 
@@ -367,7 +367,7 @@ main( string[] args )
 
 	t2.start ();
 	for (i = 0; i < y; i++) {
-		c.update (insert_query_orig.printf (i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i));
+		c.update (insert_query_orig.printf (i));
 	}
 	t2.stop ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]