Last active
December 23, 2015 08:38
-
-
Save peterneubauer/6608600 to your computer and use it in GitHub Desktop.
Revisions
-
peterneubauer revised this gist
Sep 20, 2013 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,9 +31,13 @@ Now, let's find the German captions of products that are attached to the categor [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(sub_cat)-[:CAPTION]->(caption), bev-[:CAPTION]->(cap2),(caption)<-[:TAGGED]-(product) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' AND cap2.lang='DE' RETURN bev_caption.caption AS search_term,cap2.caption AS search_term_DE,caption.caption AS found_cat, product.name ---- //table -
peterneubauer revised this gist
Sep 20, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,9 +31,9 @@ Now, let's find the German captions of products that are attached to the categor [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(sub_cat)-[:CAPTION]->(caption), bev-[:CAPTION]->(cap2), sub_cat<-[caption]-(product) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' AND cap2.lang='DE' RETURN bev_caption.caption as search_term,cap2.caption as search_term_DE,caption.caption as found_cat, product.name ---- //table -
peterneubauer revised this gist
Sep 20, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,9 +31,9 @@ Now, let's find the German captions of products that are attached to the categor [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(sub_cat)-[:CAPTION]->(caption), bev-[:CAPTION]->(cap2) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' AND cap2.lang='DE' RETURN bev_caption.caption as search_term,cap2.caption as search_term_DE,caption.caption as found_cat ---- //table -
peterneubauer revised this gist
Sep 20, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,9 +31,9 @@ Now, let's find the German captions of products that are attached to the categor [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]->(caption), bev-[:CAPTION]->(cap2) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' AND cap2.lang='DE' RETURN bev_caption.caption,cap2 ,caption.caption ---- //table -
peterneubauer revised this gist
Sep 20, 2013 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ = A case of nested subcategories //console In many multilingual systems, there are nested hierarchis of categories, connected to different products that need to be searched by customers with different language preferences. Here is a possible approach, inspired by the http://wordnetweb.princeton.edu/perl/webwn?o2=&o0=1&o8=1&o1=1&o7=&o5=&o9=&o6=&o3=&o4=&s=drink[Wordnet Project]. == The setup @@ -27,6 +27,8 @@ CREATE ({name:"Wein"})-[:TAGGED]->(alc_de) == Find English things that are beverages Now, let's find the German captions of products that are attached to the category or one of its subcategories of the one that has an English caption `beverages`. [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption) -
peterneubauer renamed this gist
Sep 18, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
peterneubauer renamed this gist
Sep 18, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,9 @@ //console In many multilingual systems, there are hierarchis of categories, connected to different products that need to be searched by customers with different language preferences. Here is a possible approach, inspired by the http://wordnetweb.princeton.edu/perl/webwn?o2=&o0=1&o8=1&o1=1&o7=&o5=&o9=&o6=&o3=&o4=&s=drink[Wordnet Project]. == The setup //setup -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc) CREATE (alc)-[:CAPTION]->(alc_de{caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) CREATE ({name:"Wein"})-[:TAGGED]->(alc_de) ---- //graph -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc) CREATE (alc)-[:CAPTION]->(alc_de{caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) CREATE ({name:"Wein"})-[:TAGGED]->(acl_de) ---- //graph @@ -27,9 +27,9 @@ CREATE ({name:"Wein"})-[:TAGGED]->(alc_de) [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' RETURN bev_caption.caption, caption.caption ---- //table -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc) CREATE (alc)-[:CAPTION]->(alc_de{caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) CREATE ({name:"Wein"})-[:TAGGED]->(alc_de) ---- //graph @@ -27,9 +27,9 @@ CREATE ({name:"Wein"})-[:TAGGED]->(acl_de) [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption)<-[:TAGGED]-(product) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' RETURN bev_caption.caption, caption.caption, cat, product.name ---- //table -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,9 @@ CREATE (alc{name:'C2'}) CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr) CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc) CREATE (alc)-[:CAPTION]->(alc_de{caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) CREATE ({name:"Wein"})-[:TAGGED]->(acl_de) ---- //graph -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ CREATE (getr)<-[:IS_A]-(alc) ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' RETURN bev_caption.caption, caption.caption ---- //table -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,3 +30,5 @@ MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' RETURN bev_caption.caption.caption, caption.caption ---- //table -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,11 @@ CREATE (getr)<-[:IS_A]-(alc) //table == Find English things that are beverages [source,cypher] ---- MATCH (bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(cat)-[:CAPTION]-(caption) WHERE bev_caption.caption = 'beverages' AND caption.lang='DE' RETURN bev_caption.caption.caption, caption.caption ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ CREATE (getr{name:'C1'}) CREATE (alc{name:'C2'}) CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr) CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc) CREATE (alc)-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,12 @@ //setup [source,cypher] ---- CREATE (getr{name:'C1'}) CREATE (alc{name:'C2'}) CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr) CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(c2) CREATE (alc)-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,10 @@ //setup [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'}), CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}), CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'}), CREATE (alc)-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}), CREATE (getr)<-[:IS_A]-(alc) ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 4 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,12 +8,10 @@ //setup [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'})-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoloic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'})-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- //graph -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,12 @@ //setup [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'})-[:CAPTION]->({caption:'Getraenke', lang:'DE'}), (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}), ({caption:'alcoloic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'}), (alc)-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}), (getr)<-[:IS_A]-(alc) ---- //graph -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'})-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoloic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'})-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ //setup [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'})-[:CAPTION]->({caption:'Getraenke', lang:'DE'}) CREATE ({caption:'alcoloic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'})-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,16 @@ //setup [source,cypher] ---- CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr{name:'C1'})-[:CAPTION]->({caption:'Getränke', lang:'DE'}) CREATE ({caption:'alcoloic stuff', lang:'EN'})<-[:CAPTION]-(alc{name:'C2'})-[:CAPTION]->({caption:'Alkoholika', lang:'DE'}) CREATE (getr)<-[:IS_A]-(alc) ---- //graph //table == Query 2 [source,] -
peterneubauer revised this gist
Sep 18, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,8 @@ == First, let's rock //setup [source,cypher] ---- CREATE (n{name:'Hi there'}) -
peterneubauer created this gist
Sep 18, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ = Vienna is cool //console == First, let's rock [source,cypher] ---- CREATE (n{name:'Hi there'}) RETURN n ---- //graph //table