instant-local-throwaway
Advanced tools
Comparing version 1.1.1 to 1.1.2
[ | ||
[100, "person/name", "James Cameron"], | ||
[100, "person/born", "1954-08-16T00:00:00Z"], | ||
[101, "person/name", "Arnold Schwarzenegger"], | ||
[101, "person/born", "1947-07-30T00:00:00Z"], | ||
[102, "person/name", "Linda Hamilton"], | ||
[102, "person/born", "1956-09-26T00:00:00Z"], | ||
[103, "person/name", "Michael Biehn"], | ||
[103, "person/born", "1956-07-31T00:00:00Z"], | ||
[104, "person/name", "Ted Kotcheff"], | ||
[104, "person/born", "1931-04-07T00:00:00Z"], | ||
[105, "person/name", "Sylvester Stallone"], | ||
[105, "person/born", "1946-07-06T00:00:00Z"], | ||
[106, "person/name", "Richard Crenna"], | ||
[106, "person/born", "1926-11-30T00:00:00Z"], | ||
[106, "person/death", "2003-01-17T00:00:00Z"], | ||
[107, "person/name", "Brian Dennehy"], | ||
[107, "person/born", "1938-07-09T00:00:00Z"], | ||
[108, "person/name", "John McTiernan"], | ||
[108, "person/born", "1951-01-08T00:00:00Z"], | ||
[109, "person/name", "Elpidia Carrillo"], | ||
[109, "person/born", "1961-08-16T00:00:00Z"], | ||
[110, "person/name", "Carl Weathers"], | ||
[110, "person/born", "1948-01-14T00:00:00Z"], | ||
[111, "person/name", "Richard Donner"], | ||
[111, "person/born", "1930-04-24T00:00:00Z"], | ||
[112, "person/name", "Mel Gibson"], | ||
[112, "person/born", "1956-01-03T00:00:00Z"], | ||
[113, "person/name", "Danny Glover"], | ||
[113, "person/born", "1946-07-22T00:00:00Z"], | ||
[114, "person/name", "Gary Busey"], | ||
[114, "person/born", "1944-07-29T00:00:00Z"], | ||
[115, "person/name", "Paul Verhoeven"], | ||
[115, "person/born", "1938-07-18T00:00:00Z"], | ||
[116, "person/name", "Peter Weller"], | ||
[116, "person/born", "1947-06-24T00:00:00Z"], | ||
[117, "person/name", "Nancy Allen"], | ||
[117, "person/born", "1950-06-24T00:00:00Z"], | ||
[118, "person/name", "Ronny Cox"], | ||
[118, "person/born", "1938-07-23T00:00:00Z"], | ||
[119, "person/name", "Mark L. Lester"], | ||
[119, "person/born", "1946-11-26T00:00:00Z"], | ||
[120, "person/name", "Rae Dawn Chong"], | ||
[120, "person/born", "1961-02-28T00:00:00Z"], | ||
[121, "person/name", "Alyssa Milano"], | ||
[121, "person/born", "1972-12-19T00:00:00Z"], | ||
[122, "person/name", "Bruce Willis"], | ||
[122, "person/born", "1955-03-19T00:00:00Z"], | ||
[123, "person/name", "Alan Rickman"], | ||
[123, "person/born", "1946-02-21T00:00:00Z"], | ||
[124, "person/name", "Alexander Godunov"], | ||
[124, "person/born", "1949-11-28T00:00:00Z"], | ||
[124, "person/death", "1995-05-18T00:00:00Z"], | ||
[125, "person/name", "Robert Patrick"], | ||
[125, "person/born", "1958-11-05T00:00:00Z"], | ||
[126, "person/name", "Edward Furlong"], | ||
[126, "person/born", "1977-08-02T00:00:00Z"], | ||
[127, "person/name", "Jonathan Mostow"], | ||
[127, "person/born", "1961-11-28T00:00:00Z"], | ||
[128, "person/name", "Nick Stahl"], | ||
[128, "person/born", "1979-12-05T00:00:00Z"], | ||
[129, "person/name", "Claire Danes"], | ||
[129, "person/born", "1979-04-12T00:00:00Z"], | ||
[130, "person/name", "George P. Cosmatos"], | ||
[130, "person/born", "1941-01-04T00:00:00Z"], | ||
[130, "person/death", "2005-04-19T00:00:00Z"], | ||
[131, "person/name", "Charles Napier"], | ||
[131, "person/born", "1936-04-12T00:00:00Z"], | ||
[131, "person/death", "2011-10-05T00:00:00Z"], | ||
[132, "person/name", "Peter MacDonald"], | ||
[133, "person/name", "Marc de Jonge"], | ||
[133, "person/born", "1949-02-16T00:00:00Z"], | ||
[133, "person/death", "1996-06-06T00:00:00Z"], | ||
[134, "person/name", "Stephen Hopkins"], | ||
[135, "person/name", "Ruben Blades"], | ||
[135, "person/born", "1948-07-16T00:00:00Z"], | ||
[136, "person/name", "Joe Pesci"], | ||
[136, "person/born", "1943-02-09T00:00:00Z"], | ||
[137, "person/name", "Ridley Scott"], | ||
[137, "person/born", "1937-11-30T00:00:00Z"], | ||
[138, "person/name", "Tom Skerritt"], | ||
[138, "person/born", "1933-08-25T00:00:00Z"], | ||
[139, "person/name", "Sigourney Weaver"], | ||
[139, "person/born", "1949-10-08T00:00:00Z"], | ||
[140, "person/name", "Veronica Cartwright"], | ||
[140, "person/born", "1949-04-20T00:00:00Z"], | ||
[141, "person/name", "Carrie Henn"], | ||
[142, "person/name", "George Miller"], | ||
[142, "person/born", "1945-03-03T00:00:00Z"], | ||
[143, "person/name", "Steve Bisley"], | ||
[143, "person/born", "1951-12-26T00:00:00Z"], | ||
[144, "person/name", "Joanne Samuel"], | ||
[145, "person/name", "Michael Preston"], | ||
[145, "person/born", "1938-05-14T00:00:00Z"], | ||
[146, "person/name", "Bruce Spence"], | ||
[146, "person/born", "1945-09-17T00:00:00Z"], | ||
[147, "person/name", "George Ogilvie"], | ||
[147, "person/born", "1931-03-05T00:00:00Z"], | ||
[148, "person/name", "Tina Turner"], | ||
[148, "person/born", "1939-11-26T00:00:00Z"], | ||
[149, "person/name", "Sophie Marceau"], | ||
[149, "person/born", "1966-11-17T00:00:00Z"], | ||
[200, "movie/title", "The Terminator"], | ||
[200, "movie/year", 1984], | ||
[200, "movie/director", 100], | ||
[200, "movie/cast", 101], | ||
[200, "movie/cast", 102], | ||
[200, "movie/cast", 103], | ||
[200, "movie/sequel", 207], | ||
[201, "movie/title", "First Blood"], | ||
[201, "movie/year", 1982], | ||
[201, "movie/director", 104], | ||
[201, "movie/cast", 105], | ||
[201, "movie/cast", 106], | ||
[201, "movie/cast", 107], | ||
[201, "movie/sequel", 209], | ||
[202, "movie/title", "Predator"], | ||
[202, "movie/year", 1987], | ||
[202, "movie/director", 108], | ||
[202, "movie/cast", 101], | ||
[202, "movie/cast", 109], | ||
[202, "movie/cast", 110], | ||
[202, "movie/sequel", 211], | ||
[203, "movie/title", "Lethal Weapon"], | ||
[203, "movie/year", 1987], | ||
[203, "movie/director", 111], | ||
[203, "movie/cast", 112], | ||
[203, "movie/cast", 113], | ||
[203, "movie/cast", 114], | ||
[203, "movie/sequel", 212], | ||
[204, "movie/title", "RoboCop"], | ||
[204, "movie/year", 1987], | ||
[204, "movie/director", 115], | ||
[204, "movie/cast", 116], | ||
[204, "movie/cast", 117], | ||
[204, "movie/cast", 118], | ||
[205, "movie/title", "Commando"], | ||
[205, "movie/year", 1985], | ||
[205, "movie/director", 119], | ||
[205, "movie/cast", 101], | ||
[205, "movie/cast", 120], | ||
[205, "movie/cast", 121], | ||
[ | ||
100, | ||
"person/name", | ||
"James Cameron" | ||
], | ||
[ | ||
100, | ||
"person/born", | ||
"1954-08-16T00:00:00Z" | ||
], | ||
[ | ||
101, | ||
"person/name", | ||
"Arnold Schwarzenegger" | ||
], | ||
[ | ||
101, | ||
"person/born", | ||
"1947-07-30T00:00:00Z" | ||
], | ||
[ | ||
102, | ||
"person/name", | ||
"Linda Hamilton" | ||
], | ||
[ | ||
102, | ||
"person/born", | ||
"1956-09-26T00:00:00Z" | ||
], | ||
[ | ||
103, | ||
"person/name", | ||
"Michael Biehn" | ||
], | ||
[ | ||
103, | ||
"person/born", | ||
"1956-07-31T00:00:00Z" | ||
], | ||
[ | ||
104, | ||
"person/name", | ||
"Ted Kotcheff" | ||
], | ||
[ | ||
104, | ||
"person/born", | ||
"1931-04-07T00:00:00Z" | ||
], | ||
[ | ||
105, | ||
"person/name", | ||
"Sylvester Stallone" | ||
], | ||
[ | ||
105, | ||
"person/born", | ||
"1946-07-06T00:00:00Z" | ||
], | ||
[ | ||
106, | ||
"person/name", | ||
"Richard Crenna" | ||
], | ||
[ | ||
106, | ||
"person/born", | ||
"1926-11-30T00:00:00Z" | ||
], | ||
[ | ||
106, | ||
"person/death", | ||
"2003-01-17T00:00:00Z" | ||
], | ||
[ | ||
107, | ||
"person/name", | ||
"Brian Dennehy" | ||
], | ||
[ | ||
107, | ||
"person/born", | ||
"1938-07-09T00:00:00Z" | ||
], | ||
[ | ||
108, | ||
"person/name", | ||
"John McTiernan" | ||
], | ||
[ | ||
108, | ||
"person/born", | ||
"1951-01-08T00:00:00Z" | ||
], | ||
[ | ||
109, | ||
"person/name", | ||
"Elpidia Carrillo" | ||
], | ||
[ | ||
109, | ||
"person/born", | ||
"1961-08-16T00:00:00Z" | ||
], | ||
[ | ||
110, | ||
"person/name", | ||
"Carl Weathers" | ||
], | ||
[ | ||
110, | ||
"person/born", | ||
"1948-01-14T00:00:00Z" | ||
], | ||
[ | ||
111, | ||
"person/name", | ||
"Richard Donner" | ||
], | ||
[ | ||
111, | ||
"person/born", | ||
"1930-04-24T00:00:00Z" | ||
], | ||
[ | ||
112, | ||
"person/name", | ||
"Mel Gibson" | ||
], | ||
[ | ||
112, | ||
"person/born", | ||
"1956-01-03T00:00:00Z" | ||
], | ||
[ | ||
113, | ||
"person/name", | ||
"Danny Glover" | ||
], | ||
[ | ||
113, | ||
"person/born", | ||
"1946-07-22T00:00:00Z" | ||
], | ||
[ | ||
114, | ||
"person/name", | ||
"Gary Busey" | ||
], | ||
[ | ||
114, | ||
"person/born", | ||
"1944-07-29T00:00:00Z" | ||
], | ||
[ | ||
115, | ||
"person/name", | ||
"Paul Verhoeven" | ||
], | ||
[ | ||
115, | ||
"person/born", | ||
"1938-07-18T00:00:00Z" | ||
], | ||
[ | ||
116, | ||
"person/name", | ||
"Peter Weller" | ||
], | ||
[ | ||
116, | ||
"person/born", | ||
"1947-06-24T00:00:00Z" | ||
], | ||
[ | ||
117, | ||
"person/name", | ||
"Nancy Allen" | ||
], | ||
[ | ||
117, | ||
"person/born", | ||
"1950-06-24T00:00:00Z" | ||
], | ||
[ | ||
118, | ||
"person/name", | ||
"Ronny Cox" | ||
], | ||
[ | ||
118, | ||
"person/born", | ||
"1938-07-23T00:00:00Z" | ||
], | ||
[ | ||
119, | ||
"person/name", | ||
"Mark L. Lester" | ||
], | ||
[ | ||
119, | ||
"person/born", | ||
"1946-11-26T00:00:00Z" | ||
], | ||
[ | ||
120, | ||
"person/name", | ||
"Rae Dawn Chong" | ||
], | ||
[ | ||
120, | ||
"person/born", | ||
"1961-02-28T00:00:00Z" | ||
], | ||
[ | ||
121, | ||
"person/name", | ||
"Alyssa Milano" | ||
], | ||
[ | ||
121, | ||
"person/born", | ||
"1972-12-19T00:00:00Z" | ||
], | ||
[ | ||
122, | ||
"person/name", | ||
"Bruce Willis" | ||
], | ||
[ | ||
122, | ||
"person/born", | ||
"1955-03-19T00:00:00Z" | ||
], | ||
[ | ||
123, | ||
"person/name", | ||
"Alan Rickman" | ||
], | ||
[ | ||
123, | ||
"person/born", | ||
"1946-02-21T00:00:00Z" | ||
], | ||
[ | ||
124, | ||
"person/name", | ||
"Alexander Godunov" | ||
], | ||
[ | ||
124, | ||
"person/born", | ||
"1949-11-28T00:00:00Z" | ||
], | ||
[ | ||
124, | ||
"person/death", | ||
"1995-05-18T00:00:00Z" | ||
], | ||
[ | ||
125, | ||
"person/name", | ||
"Robert Patrick" | ||
], | ||
[ | ||
125, | ||
"person/born", | ||
"1958-11-05T00:00:00Z" | ||
], | ||
[ | ||
126, | ||
"person/name", | ||
"Edward Furlong" | ||
], | ||
[ | ||
126, | ||
"person/born", | ||
"1977-08-02T00:00:00Z" | ||
], | ||
[ | ||
127, | ||
"person/name", | ||
"Jonathan Mostow" | ||
], | ||
[ | ||
127, | ||
"person/born", | ||
"1961-11-28T00:00:00Z" | ||
], | ||
[ | ||
128, | ||
"person/name", | ||
"Nick Stahl" | ||
], | ||
[ | ||
128, | ||
"person/born", | ||
"1979-12-05T00:00:00Z" | ||
], | ||
[ | ||
129, | ||
"person/name", | ||
"Claire Danes" | ||
], | ||
[ | ||
129, | ||
"person/born", | ||
"1979-04-12T00:00:00Z" | ||
], | ||
[ | ||
130, | ||
"person/name", | ||
"George P. Cosmatos" | ||
], | ||
[ | ||
130, | ||
"person/born", | ||
"1941-01-04T00:00:00Z" | ||
], | ||
[ | ||
130, | ||
"person/death", | ||
"2005-04-19T00:00:00Z" | ||
], | ||
[ | ||
131, | ||
"person/name", | ||
"Charles Napier" | ||
], | ||
[ | ||
131, | ||
"person/born", | ||
"1936-04-12T00:00:00Z" | ||
], | ||
[ | ||
131, | ||
"person/death", | ||
"2011-10-05T00:00:00Z" | ||
], | ||
[ | ||
132, | ||
"person/name", | ||
"Peter MacDonald" | ||
], | ||
[ | ||
133, | ||
"person/name", | ||
"Marc de Jonge" | ||
], | ||
[ | ||
133, | ||
"person/born", | ||
"1949-02-16T00:00:00Z" | ||
], | ||
[ | ||
133, | ||
"person/death", | ||
"1996-06-06T00:00:00Z" | ||
], | ||
[ | ||
134, | ||
"person/name", | ||
"Stephen Hopkins" | ||
], | ||
[ | ||
135, | ||
"person/name", | ||
"Ruben Blades" | ||
], | ||
[ | ||
135, | ||
"person/born", | ||
"1948-07-16T00:00:00Z" | ||
], | ||
[ | ||
136, | ||
"person/name", | ||
"Joe Pesci" | ||
], | ||
[ | ||
136, | ||
"person/born", | ||
"1943-02-09T00:00:00Z" | ||
], | ||
[ | ||
137, | ||
"person/name", | ||
"Ridley Scott" | ||
], | ||
[ | ||
137, | ||
"person/born", | ||
"1937-11-30T00:00:00Z" | ||
], | ||
[ | ||
138, | ||
"person/name", | ||
"Tom Skerritt" | ||
], | ||
[ | ||
138, | ||
"person/born", | ||
"1933-08-25T00:00:00Z" | ||
], | ||
[ | ||
139, | ||
"person/name", | ||
"Sigourney Weaver" | ||
], | ||
[ | ||
139, | ||
"person/born", | ||
"1949-10-08T00:00:00Z" | ||
], | ||
[ | ||
140, | ||
"person/name", | ||
"Veronica Cartwright" | ||
], | ||
[ | ||
140, | ||
"person/born", | ||
"1949-04-20T00:00:00Z" | ||
], | ||
[ | ||
141, | ||
"person/name", | ||
"Carrie Henn" | ||
], | ||
[ | ||
142, | ||
"person/name", | ||
"George Miller" | ||
], | ||
[ | ||
142, | ||
"person/born", | ||
"1945-03-03T00:00:00Z" | ||
], | ||
[ | ||
143, | ||
"person/name", | ||
"Steve Bisley" | ||
], | ||
[ | ||
143, | ||
"person/born", | ||
"1951-12-26T00:00:00Z" | ||
], | ||
[ | ||
144, | ||
"person/name", | ||
"Joanne Samuel" | ||
], | ||
[ | ||
145, | ||
"person/name", | ||
"Michael Preston" | ||
], | ||
[ | ||
145, | ||
"person/born", | ||
"1938-05-14T00:00:00Z" | ||
], | ||
[ | ||
146, | ||
"person/name", | ||
"Bruce Spence" | ||
], | ||
[ | ||
146, | ||
"person/born", | ||
"1945-09-17T00:00:00Z" | ||
], | ||
[ | ||
147, | ||
"person/name", | ||
"George Ogilvie" | ||
], | ||
[ | ||
147, | ||
"person/born", | ||
"1931-03-05T00:00:00Z" | ||
], | ||
[ | ||
148, | ||
"person/name", | ||
"Tina Turner" | ||
], | ||
[ | ||
148, | ||
"person/born", | ||
"1939-11-26T00:00:00Z" | ||
], | ||
[ | ||
149, | ||
"person/name", | ||
"Sophie Marceau" | ||
], | ||
[ | ||
149, | ||
"person/born", | ||
"1966-11-17T00:00:00Z" | ||
], | ||
[ | ||
200, | ||
"movie/title", | ||
"The Terminator" | ||
], | ||
[ | ||
200, | ||
"movie/year", | ||
1984 | ||
], | ||
[ | ||
200, | ||
"movie/director", | ||
100 | ||
], | ||
[ | ||
200, | ||
"movie/cast", | ||
101 | ||
], | ||
[ | ||
200, | ||
"movie/cast", | ||
102 | ||
], | ||
[ | ||
200, | ||
"movie/cast", | ||
103 | ||
], | ||
[ | ||
200, | ||
"movie/sequel", | ||
207 | ||
], | ||
[ | ||
201, | ||
"movie/title", | ||
"First Blood" | ||
], | ||
[ | ||
201, | ||
"movie/year", | ||
1982 | ||
], | ||
[ | ||
201, | ||
"movie/director", | ||
104 | ||
], | ||
[ | ||
201, | ||
"movie/cast", | ||
105 | ||
], | ||
[ | ||
201, | ||
"movie/cast", | ||
106 | ||
], | ||
[ | ||
201, | ||
"movie/cast", | ||
107 | ||
], | ||
[ | ||
201, | ||
"movie/sequel", | ||
209 | ||
], | ||
[ | ||
202, | ||
"movie/title", | ||
"Predator" | ||
], | ||
[ | ||
202, | ||
"movie/year", | ||
1987 | ||
], | ||
[ | ||
202, | ||
"movie/director", | ||
108 | ||
], | ||
[ | ||
202, | ||
"movie/cast", | ||
101 | ||
], | ||
[ | ||
202, | ||
"movie/cast", | ||
109 | ||
], | ||
[ | ||
202, | ||
"movie/cast", | ||
110 | ||
], | ||
[ | ||
202, | ||
"movie/sequel", | ||
211 | ||
], | ||
[ | ||
203, | ||
"movie/title", | ||
"Lethal Weapon" | ||
], | ||
[ | ||
203, | ||
"movie/year", | ||
1987 | ||
], | ||
[ | ||
203, | ||
"movie/director", | ||
111 | ||
], | ||
[ | ||
203, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
203, | ||
"movie/cast", | ||
113 | ||
], | ||
[ | ||
203, | ||
"movie/cast", | ||
114 | ||
], | ||
[ | ||
203, | ||
"movie/sequel", | ||
212 | ||
], | ||
[ | ||
204, | ||
"movie/title", | ||
"RoboCop" | ||
], | ||
[ | ||
204, | ||
"movie/year", | ||
1987 | ||
], | ||
[ | ||
204, | ||
"movie/director", | ||
115 | ||
], | ||
[ | ||
204, | ||
"movie/cast", | ||
116 | ||
], | ||
[ | ||
204, | ||
"movie/cast", | ||
117 | ||
], | ||
[ | ||
204, | ||
"movie/cast", | ||
118 | ||
], | ||
[ | ||
205, | ||
"movie/title", | ||
"Commando" | ||
], | ||
[ | ||
205, | ||
"movie/year", | ||
1985 | ||
], | ||
[ | ||
205, | ||
"movie/director", | ||
119 | ||
], | ||
[ | ||
205, | ||
"movie/cast", | ||
101 | ||
], | ||
[ | ||
205, | ||
"movie/cast", | ||
120 | ||
], | ||
[ | ||
205, | ||
"movie/cast", | ||
121 | ||
], | ||
[ | ||
205, | ||
"trivia", | ||
"In 1986, a sequel was written with an eye to having\n John McTiernan direct. Schwarzenegger wasn't interested in reprising\n the role. The script was then reworked with a new central character,\n eventually played by Bruce Willis, and became Die Hard" | ||
], | ||
[ | ||
206, | ||
"movie/title", | ||
"Die Hard" | ||
], | ||
[ | ||
206, | ||
"movie/year", | ||
1988 | ||
], | ||
[ | ||
206, | ||
"movie/director", | ||
108 | ||
], | ||
[ | ||
206, | ||
"movie/cast", | ||
122 | ||
], | ||
[ | ||
206, | ||
"movie/cast", | ||
123 | ||
], | ||
[ | ||
206, | ||
"movie/cast", | ||
124 | ||
], | ||
[ | ||
207, | ||
"movie/title", | ||
"Terminator 2: Judgment Day" | ||
], | ||
[ | ||
207, | ||
"movie/year", | ||
1991 | ||
], | ||
[ | ||
207, | ||
"movie/director", | ||
100 | ||
], | ||
[ | ||
207, | ||
"movie/cast", | ||
101 | ||
], | ||
[ | ||
207, | ||
"movie/cast", | ||
102 | ||
], | ||
[ | ||
207, | ||
"movie/cast", | ||
125 | ||
], | ||
[ | ||
207, | ||
"movie/cast", | ||
126 | ||
], | ||
[ | ||
207, | ||
"movie/sequel", | ||
208 | ||
], | ||
[ | ||
208, | ||
"movie/title", | ||
"Terminator 3: Rise of the Machines" | ||
], | ||
[ | ||
208, | ||
"movie/year", | ||
2003 | ||
], | ||
[ | ||
208, | ||
"movie/director", | ||
127 | ||
], | ||
[ | ||
208, | ||
"movie/cast", | ||
101 | ||
], | ||
[ | ||
208, | ||
"movie/cast", | ||
128 | ||
], | ||
[ | ||
208, | ||
"movie/cast", | ||
129 | ||
], | ||
[ | ||
209, | ||
"movie/title", | ||
"Rambo: First Blood Part II" | ||
], | ||
[ | ||
209, | ||
"movie/year", | ||
1985 | ||
], | ||
[ | ||
209, | ||
"movie/director", | ||
130 | ||
], | ||
[ | ||
209, | ||
"movie/cast", | ||
105 | ||
], | ||
[ | ||
209, | ||
"movie/cast", | ||
106 | ||
], | ||
[ | ||
209, | ||
"movie/cast", | ||
131 | ||
], | ||
[ | ||
209, | ||
"movie/sequel", | ||
210 | ||
], | ||
[ | ||
210, | ||
"movie/title", | ||
"Rambo III" | ||
], | ||
[ | ||
210, | ||
"movie/year", | ||
1988 | ||
], | ||
[ | ||
210, | ||
"movie/director", | ||
132 | ||
], | ||
[ | ||
210, | ||
"movie/cast", | ||
105 | ||
], | ||
[ | ||
210, | ||
"movie/cast", | ||
106 | ||
], | ||
[ | ||
210, | ||
"movie/cast", | ||
133 | ||
], | ||
[ | ||
211, | ||
"movie/title", | ||
"Predator 2" | ||
], | ||
[ | ||
211, | ||
"movie/year", | ||
1990 | ||
], | ||
[ | ||
211, | ||
"movie/director", | ||
134 | ||
], | ||
[ | ||
211, | ||
"movie/cast", | ||
113 | ||
], | ||
[ | ||
211, | ||
"movie/cast", | ||
114 | ||
], | ||
[ | ||
211, | ||
"movie/cast", | ||
135 | ||
], | ||
[ | ||
212, | ||
"movie/title", | ||
"Lethal Weapon 2" | ||
], | ||
[ | ||
212, | ||
"movie/year", | ||
1989 | ||
], | ||
[ | ||
212, | ||
"movie/director", | ||
111 | ||
], | ||
[ | ||
212, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
212, | ||
"movie/cast", | ||
113 | ||
], | ||
[ | ||
212, | ||
"movie/cast", | ||
136 | ||
], | ||
[ | ||
212, | ||
"movie/sequel", | ||
213 | ||
], | ||
[ | ||
213, | ||
"movie/title", | ||
"Lethal Weapon 3" | ||
], | ||
[ | ||
213, | ||
"movie/year", | ||
1992 | ||
], | ||
[ | ||
213, | ||
"movie/director", | ||
111 | ||
], | ||
[ | ||
213, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
213, | ||
"movie/cast", | ||
113 | ||
], | ||
[ | ||
213, | ||
"movie/cast", | ||
136 | ||
], | ||
[ | ||
214, | ||
"movie/title", | ||
"Alien" | ||
], | ||
[ | ||
214, | ||
"movie/year", | ||
1979 | ||
], | ||
[ | ||
214, | ||
"movie/director", | ||
137 | ||
], | ||
[ | ||
214, | ||
"movie/cast", | ||
138 | ||
], | ||
[ | ||
214, | ||
"movie/cast", | ||
139 | ||
], | ||
[ | ||
214, | ||
"movie/cast", | ||
140 | ||
], | ||
[ | ||
214, | ||
"movie/sequel", | ||
215 | ||
], | ||
[ | ||
215, | ||
"movie/title", | ||
"Aliens" | ||
], | ||
[ | ||
215, | ||
"movie/year", | ||
1986 | ||
], | ||
[ | ||
215, | ||
"movie/director", | ||
100 | ||
], | ||
[ | ||
215, | ||
"movie/cast", | ||
139 | ||
], | ||
[ | ||
215, | ||
"movie/cast", | ||
141 | ||
], | ||
[ | ||
215, | ||
"movie/cast", | ||
103 | ||
], | ||
[ | ||
216, | ||
"movie/title", | ||
"Mad Max" | ||
], | ||
[ | ||
216, | ||
"movie/year", | ||
1979 | ||
], | ||
[ | ||
216, | ||
"movie/director", | ||
142 | ||
], | ||
[ | ||
216, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
216, | ||
"movie/cast", | ||
143 | ||
], | ||
[ | ||
216, | ||
"movie/cast", | ||
144 | ||
], | ||
[ | ||
216, | ||
"movie/sequel", | ||
217 | ||
], | ||
[ | ||
217, | ||
"movie/title", | ||
"Mad Max 2" | ||
], | ||
[ | ||
217, | ||
"movie/year", | ||
1981 | ||
], | ||
[ | ||
217, | ||
"movie/director", | ||
142 | ||
], | ||
[ | ||
217, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
217, | ||
"movie/cast", | ||
145 | ||
], | ||
[ | ||
217, | ||
"movie/cast", | ||
146 | ||
], | ||
[ | ||
217, | ||
"movie/sequel", | ||
218 | ||
], | ||
[ | ||
218, | ||
"movie/title", | ||
"Mad Max Beyond Thunderdome" | ||
], | ||
[ | ||
218, | ||
"movie/year", | ||
1985 | ||
], | ||
[ | ||
218, | ||
"movie/director", | ||
"user" | ||
], | ||
[ | ||
218, | ||
"movie/director", | ||
147 | ||
], | ||
[ | ||
218, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
218, | ||
"movie/cast", | ||
148 | ||
], | ||
[ | ||
219, | ||
"movie/title", | ||
"Braveheart" | ||
], | ||
[ | ||
219, | ||
"movie/year", | ||
1995 | ||
], | ||
[ | ||
219, | ||
"movie/director", | ||
112 | ||
], | ||
[ | ||
219, | ||
"movie/cast", | ||
112 | ||
], | ||
[ | ||
219, | ||
"movie/cast", | ||
149 | ||
] | ||
] | ||
[206, "movie/title", "Die Hard"], | ||
[206, "movie/year", 1988], | ||
[206, "movie/director", 108], | ||
[206, "movie/cast", 122], | ||
[206, "movie/cast", 123], | ||
[206, "movie/cast", 124], | ||
[207, "movie/title", "Terminator 2: Judgment Day"], | ||
[207, "movie/year", 1991], | ||
[207, "movie/director", 100], | ||
[207, "movie/cast", 101], | ||
[207, "movie/cast", 102], | ||
[207, "movie/cast", 125], | ||
[207, "movie/cast", 126], | ||
[207, "movie/sequel", 208], | ||
[208, "movie/title", "Terminator 3: Rise of the Machines"], | ||
[208, "movie/year", 2003], | ||
[208, "movie/director", 127], | ||
[208, "movie/cast", 101], | ||
[208, "movie/cast", 128], | ||
[208, "movie/cast", 129], | ||
[209, "movie/title", "Rambo: First Blood Part II"], | ||
[209, "movie/year", 1985], | ||
[209, "movie/director", 130], | ||
[209, "movie/cast", 105], | ||
[209, "movie/cast", 106], | ||
[209, "movie/cast", 131], | ||
[209, "movie/sequel", 210], | ||
[210, "movie/title", "Rambo III"], | ||
[210, "movie/year", 1988], | ||
[210, "movie/director", 132], | ||
[210, "movie/cast", 105], | ||
[210, "movie/cast", 106], | ||
[210, "movie/cast", 133], | ||
[211, "movie/title", "Predator 2"], | ||
[211, "movie/year", 1990], | ||
[211, "movie/director", 134], | ||
[211, "movie/cast", 113], | ||
[211, "movie/cast", 114], | ||
[211, "movie/cast", 135], | ||
[212, "movie/title", "Lethal Weapon 2"], | ||
[212, "movie/year", 1989], | ||
[212, "movie/director", 111], | ||
[212, "movie/cast", 112], | ||
[212, "movie/cast", 113], | ||
[212, "movie/cast", 136], | ||
[212, "movie/sequel", 213], | ||
[213, "movie/title", "Lethal Weapon 3"], | ||
[213, "movie/year", 1992], | ||
[213, "movie/director", 111], | ||
[213, "movie/cast", 112], | ||
[213, "movie/cast", 113], | ||
[213, "movie/cast", 136], | ||
[214, "movie/title", "Alien"], | ||
[214, "movie/year", 1979], | ||
[214, "movie/director", 137], | ||
[214, "movie/cast", 138], | ||
[214, "movie/cast", 139], | ||
[214, "movie/cast", 140], | ||
[214, "movie/sequel", 215], | ||
[215, "movie/title", "Aliens"], | ||
[215, "movie/year", 1986], | ||
[215, "movie/director", 100], | ||
[215, "movie/cast", 139], | ||
[215, "movie/cast", 141], | ||
[215, "movie/cast", 103], | ||
[216, "movie/title", "Mad Max"], | ||
[216, "movie/year", 1979], | ||
[216, "movie/director", 142], | ||
[216, "movie/cast", 112], | ||
[216, "movie/cast", 143], | ||
[216, "movie/cast", 144], | ||
[216, "movie/sequel", 217], | ||
[217, "movie/title", "Mad Max 2"], | ||
[217, "movie/year", 1981], | ||
[217, "movie/director", 142], | ||
[217, "movie/cast", 112], | ||
[217, "movie/cast", 145], | ||
[217, "movie/cast", 146], | ||
[217, "movie/sequel", 218], | ||
[218, "movie/title", "Mad Max Beyond Thunderdome"], | ||
[218, "movie/year", 1985], | ||
[218, "movie/director", "user"], | ||
[218, "movie/director", 147], | ||
[218, "movie/cast", 112], | ||
[218, "movie/cast", 148], | ||
[219, "movie/title", "Braveheart"], | ||
[219, "movie/year", 1995], | ||
[219, "movie/director", 112], | ||
[219, "movie/cast", 112], | ||
[219, "movie/cast", 149] | ||
] |
@@ -1,20 +0,25 @@ | ||
import relevantTriples from "./data/movieTriples.json"; | ||
import { matchPattern, query, querySingle, queryWhere } from "../../instant-local/datalog"; | ||
import { createDB } from "../../instant-local/db"; | ||
import relevantTriples from './data/movieTriples.json'; | ||
import { | ||
matchPattern, | ||
query, | ||
querySingle, | ||
queryWhere, | ||
} from '../../instant-local/datalog'; | ||
import { createStore } from '../../instant-local/store'; | ||
const db = createDB(relevantTriples); | ||
const db = createStore(relevantTriples); | ||
test("matchPattern", () => { | ||
test('matchPattern', () => { | ||
expect( | ||
matchPattern( | ||
["?movieId", "movie/director", "?directorId"], | ||
[200, "movie/director", 100], | ||
{ "?movieId": 200 } | ||
['?movieId', 'movie/director', '?directorId'], | ||
[200, 'movie/director', 100], | ||
{ '?movieId': 200 } | ||
) | ||
).toEqual({ "?movieId": 200, "?directorId": 100 }); | ||
).toEqual({ '?movieId': 200, '?directorId': 100 }); | ||
expect( | ||
matchPattern( | ||
["?movieId", "movie/director", "?directorId"], | ||
[200, "movie/director", 100], | ||
{ "?movieId": 202 } | ||
['?movieId', 'movie/director', '?directorId'], | ||
[200, 'movie/director', 100], | ||
{ '?movieId': 202 } | ||
) | ||
@@ -24,17 +29,17 @@ ).toEqual(null); | ||
test("querySingle", () => { | ||
expect(querySingle(["?movieId", "movie/year", 1987], db, {})).toEqual([ | ||
{ "?movieId": 202 }, | ||
{ "?movieId": 203 }, | ||
{ "?movieId": 204 }, | ||
test('querySingle', () => { | ||
expect(querySingle(['?movieId', 'movie/year', 1987], db, {})).toEqual([ | ||
{ '?movieId': 202 }, | ||
{ '?movieId': 203 }, | ||
{ '?movieId': 204 }, | ||
]); | ||
}); | ||
test("queryWhere", () => { | ||
test('queryWhere', () => { | ||
expect( | ||
queryWhere( | ||
[ | ||
["?movieId", "movie/title", "The Terminator"], | ||
["?movieId", "movie/director", "?directorId"], | ||
["?directorId", "person/name", "?directorName"], | ||
['?movieId', 'movie/title', 'The Terminator'], | ||
['?movieId', 'movie/director', '?directorId'], | ||
['?directorId', 'person/name', '?directorName'], | ||
], | ||
@@ -45,15 +50,15 @@ db, | ||
).toEqual([ | ||
{ "?movieId": 200, "?directorId": 100, "?directorName": "James Cameron" }, | ||
{ '?movieId': 200, '?directorId': 100, '?directorName': 'James Cameron' }, | ||
]); | ||
}); | ||
test("query", () => { | ||
test('query', () => { | ||
expect( | ||
query( | ||
{ | ||
find: ["?directorName"], | ||
find: ['?directorName'], | ||
where: [ | ||
["?movieId", "movie/title", "The Terminator"], | ||
["?movieId", "movie/director", "?directorId"], | ||
["?directorId", "person/name", "?directorName"], | ||
['?movieId', 'movie/title', 'The Terminator'], | ||
['?movieId', 'movie/director', '?directorId'], | ||
['?directorId', 'person/name', '?directorName'], | ||
], | ||
@@ -63,11 +68,11 @@ }, | ||
) | ||
).toEqual([["James Cameron"]]); | ||
).toEqual([['James Cameron']]); | ||
}); | ||
test("play", () => { | ||
test('play', () => { | ||
expect( | ||
query( | ||
{ | ||
find: ["?eid", "?attr", "?v"], | ||
where: [["?eid", "?attr", "?v"]], | ||
find: ['?eid', '?attr', '?v'], | ||
where: [['?eid', '?attr', '?v']], | ||
}, | ||
@@ -80,6 +85,6 @@ db | ||
{ | ||
find: ["?year"], | ||
find: ['?year'], | ||
where: [ | ||
["?id", "movie/title", "Alien"], | ||
["?id", "movie/year", "?year"], | ||
['?id', 'movie/title', 'Alien'], | ||
['?id', 'movie/year', '?year'], | ||
], | ||
@@ -93,7 +98,7 @@ }, | ||
{ | ||
find: ["?directorName"], | ||
find: ['?directorName'], | ||
where: [ | ||
["?movieId", "movie/title", "RoboCop"], | ||
["?movieId", "movie/director", "?directorId"], | ||
["?directorId", "person/name", "?directorName"], | ||
['?movieId', 'movie/title', 'RoboCop'], | ||
['?movieId', 'movie/director', '?directorId'], | ||
['?directorId', 'person/name', '?directorName'], | ||
], | ||
@@ -103,3 +108,3 @@ }, | ||
) | ||
).toEqual([["Paul Verhoeven"]]); | ||
).toEqual([['Paul Verhoeven']]); | ||
expect( | ||
@@ -109,4 +114,4 @@ new Set( | ||
{ | ||
find: ["?attr", "?value"], | ||
where: [[200, "?attr", "?value"]], | ||
find: ['?attr', '?value'], | ||
where: [[200, '?attr', '?value']], | ||
}, | ||
@@ -118,9 +123,9 @@ db | ||
new Set([ | ||
["movie/title", "The Terminator"], | ||
["movie/year", 1984], | ||
["movie/director", 100], | ||
["movie/cast", 101], | ||
["movie/cast", 102], | ||
["movie/cast", 103], | ||
["movie/sequel", 207], | ||
['movie/title', 'The Terminator'], | ||
['movie/year', 1984], | ||
['movie/director', 100], | ||
['movie/cast', 101], | ||
['movie/cast', 102], | ||
['movie/cast', 103], | ||
['movie/sequel', 207], | ||
]) | ||
@@ -132,9 +137,9 @@ ); | ||
{ | ||
find: ["?directorName", "?movieTitle"], | ||
find: ['?directorName', '?movieTitle'], | ||
where: [ | ||
["?arnoldId", "person/name", "Arnold Schwarzenegger"], | ||
["?movieId", "movie/cast", "?arnoldId"], | ||
["?movieId", "movie/title", "?movieTitle"], | ||
["?movieId", "movie/director", "?directorId"], | ||
["?directorId", "person/name", "?directorName"], | ||
['?arnoldId', 'person/name', 'Arnold Schwarzenegger'], | ||
['?movieId', 'movie/cast', '?arnoldId'], | ||
['?movieId', 'movie/title', '?movieTitle'], | ||
['?movieId', 'movie/director', '?directorId'], | ||
['?directorId', 'person/name', '?directorName'], | ||
], | ||
@@ -147,9 +152,9 @@ }, | ||
new Set([ | ||
["James Cameron", "The Terminator"], | ||
["John McTiernan", "Predator"], | ||
["Mark L. Lester", "Commando"], | ||
["James Cameron", "Terminator 2: Judgment Day"], | ||
["Jonathan Mostow", "Terminator 3: Rise of the Machines"], | ||
['James Cameron', 'The Terminator'], | ||
['John McTiernan', 'Predator'], | ||
['Mark L. Lester', 'Commando'], | ||
['James Cameron', 'Terminator 2: Judgment Day'], | ||
['Jonathan Mostow', 'Terminator 3: Rise of the Machines'], | ||
]) | ||
); | ||
}); |
@@ -1,63 +0,83 @@ | ||
import { createDB, save } from "../../instant-local/db"; | ||
import { tx, transform } from "../../instant-local/instaml"; | ||
import { query } from "../../instant-local/instaql"; | ||
import { createStore, transact } from '../../instant-local/store'; | ||
import { transform } from '../../instant-local/instaml'; | ||
import { query } from '../../instant-local/instaql'; | ||
import { tx } from '../../instant-local/instatx'; | ||
test("Update", () => { | ||
const db = createDB([["1", "users/name", "Stopa"]]); | ||
test('Update', () => { | ||
const db = createStore([['1', 'users/name', 'Stopa']]); | ||
expect( | ||
transform( | ||
[tx.users["1"].update({ name: "Stepan", twitter: "stopachka" })], | ||
[tx.users['1'].update({ name: 'Stepan', twitter: 'stopachka' })], | ||
db | ||
) | ||
).toEqual([ | ||
["retract-triple", "1", "users/name", "Stopa"], | ||
["add-triple", "1", "users/id", "1"], | ||
["add-triple", "1", "users/name", "Stepan"], | ||
["add-triple", "1", "users/twitter", "stopachka"], | ||
['add', 'users/id', 'db/namespace', 'users'], | ||
['add', 'users/id', 'db/identity', 'id'], | ||
['add', 'users/id', 'db/valueType', 'blob'], | ||
['add', 'users/id', 'db/cardinality', 'one'], | ||
['add', 'users/name', 'db/namespace', 'users'], | ||
['add', 'users/name', 'db/identity', 'name'], | ||
['add', 'users/name', 'db/valueType', 'blob'], | ||
['add', 'users/name', 'db/cardinality', 'one'], | ||
['add', 'users/twitter', 'db/namespace', 'users'], | ||
['add', 'users/twitter', 'db/identity', 'twitter'], | ||
['add', 'users/twitter', 'db/valueType', 'blob'], | ||
['add', 'users/twitter', 'db/cardinality', 'one'], | ||
['add', '1', 'users/id', '1'], | ||
['add', '1', 'users/name', 'Stepan'], | ||
['add', '1', 'users/twitter', 'stopachka'], | ||
]); | ||
}); | ||
test("Link", () => { | ||
const db = createDB([ | ||
["1", "users/name", "Stopa"], | ||
["2", "bookshelves/title", "Favs"], | ||
test('Link', () => { | ||
const db = createStore([ | ||
['1', 'users/name', 'Stopa'], | ||
['2', 'bookshelves/title', 'Favs'], | ||
]); | ||
expect(transform([tx.users["1"].link({ bookshelves: "2" })], db)).toEqual([ | ||
["retract-triple", "1", "ref$users$bookshelves", "2"], | ||
["add-triple", "1", "ref$users$bookshelves", "2"], | ||
expect(transform([tx.users['1'].link({ bookshelves: '2' })], db)).toEqual([ | ||
['add', 'ref$users$bookshelves', 'db/namespace', 'users'], | ||
['add', 'ref$users$bookshelves', 'db/identity', 'bookshelves'], | ||
['add', 'ref$users$bookshelves', 'db/valueType', 'ref'], | ||
['add', 'ref$users$bookshelves', 'db/cardinality', 'many'], | ||
['add', '1', 'ref$users$bookshelves', '2'], | ||
]); | ||
}); | ||
test("Unlink", () => { | ||
const db = createDB([ | ||
["1", "users/name", "Stopa"], | ||
["2", "bookshelves/title", "Favs"], | ||
["1", "ref$users$bookshelves", "2"], | ||
test('Unlink', () => { | ||
const db = createStore([ | ||
['1', 'users/name', 'Stopa'], | ||
['2', 'bookshelves/title', 'Favs'], | ||
['1', 'ref$users$bookshelves', '2'], | ||
]); | ||
expect(transform([tx.users["1"].unlink({ bookshelves: "2" })], db)).toEqual([ | ||
["retract-triple", "1", "ref$users$bookshelves", "2"], | ||
expect(transform([tx.users['1'].unlink({ bookshelves: '2' })], db)).toEqual([ | ||
['retract', '1', 'ref$users$bookshelves', '2'], | ||
]); | ||
}); | ||
test("Delete", () => { | ||
const db = createDB([ | ||
["1", "users/name", "Stopa"], | ||
["2", "bookshelves/title", "Favs"], | ||
["1", "ref$users$bookshelves", "2"], | ||
test('Delete', () => { | ||
const emptyDb = createStore([]); | ||
const db = transact( | ||
transform( | ||
[ | ||
tx.users['1'].link({ bookshelves: '2' }), | ||
tx.bookshelves['2'].update({ title: 'Favs' }), | ||
], | ||
emptyDb | ||
), | ||
emptyDb | ||
); | ||
expect(transform([tx.bookshelves['2'].delete()], db)).toEqual([ | ||
['retract', '1', 'ref$users$bookshelves', '2'], | ||
['retract', '2', 'bookshelves/id', '2'], | ||
['retract', '2', 'bookshelves/title', 'Favs'], | ||
]); | ||
expect(transform([tx.bookshelves["2"].delete()], db)).toEqual([ | ||
["retract-triple", "1", "ref$users$bookshelves", "2"], | ||
["retract-triple", "2", "bookshelves/title", "Favs"], | ||
]); | ||
}); | ||
test("E2E", () => { | ||
const db = createDB([]); | ||
const userTx = tx.user.a; | ||
save( | ||
test('E2E', () => { | ||
const db = createStore([]); | ||
const newDb = transact( | ||
transform( | ||
[ | ||
tx.bookshelf.b.update({ title: "Favs" }), | ||
userTx.update({ name: "Stopa" }), | ||
userTx.link({ bookshelf: "b" }), | ||
tx.bookshelf.b.update({ title: 'Favs' }), | ||
tx.user.a.update({ name: 'Stopa' }).link({ bookshelf: 'b' }), | ||
], | ||
@@ -69,6 +89,6 @@ db | ||
expect( | ||
query({ user: { $: { where: { name: "Stopa" } }, bookshelf: {} } }, db) | ||
query({ user: { $: { where: { name: 'Stopa' } }, bookshelf: {} } }, newDb) | ||
).toEqual({ | ||
user: [{ bookshelf: [{ id: "b", title: "Favs" }], id: "a", name: "Stopa" }], | ||
user: [{ bookshelf: [{ id: 'b', title: 'Favs' }], id: 'a', name: 'Stopa' }], | ||
}); | ||
}); |
@@ -1,27 +0,34 @@ | ||
import zenecaTriples from "./data/zenecaTriples.json"; | ||
import { createDB, save } from "../../instant-local/db"; | ||
import { buildWhereQuery, enhanceWithDefaults, query } from "../../instant-local/instaql"; | ||
import zenecaTriples from './data/zenecaTriples.json'; | ||
import { createStore, transact } from '../../instant-local/store'; | ||
import { tx } from '../../instant-local/instatx'; | ||
import { transform } from '../../instant-local/instaml'; | ||
const db = createDB(zenecaTriples); | ||
test("whereQuery", () => { | ||
expect(buildWhereQuery({ namespace: "users" })).toEqual({ | ||
find: "?users", | ||
where: [["?users", "users/id", "?$v"]], | ||
import { | ||
buildWhereQuery, | ||
enhanceWithDefaults, | ||
query, | ||
} from '../../instant-local/instaql'; | ||
const db = createStore(zenecaTriples); | ||
test('whereQuery', () => { | ||
expect(buildWhereQuery({ namespace: 'users' })).toEqual({ | ||
find: '?users', | ||
where: [['?users', 'users/id', '?$v']], | ||
}); | ||
expect(buildWhereQuery({ namespace: "users", where: { id: 2 } })).toEqual({ | ||
find: "?users", | ||
where: [[2, "users/id", "?users"]], | ||
expect(buildWhereQuery({ namespace: 'users', where: { id: 2 } })).toEqual({ | ||
find: '?users', | ||
where: [[2, 'users/id', '?users']], | ||
}); | ||
expect( | ||
buildWhereQuery({ | ||
namespace: "users", | ||
where: { "bookshelves.book_instances.books.id": "2" }, | ||
namespace: 'users', | ||
where: { 'bookshelves.book_instances.books.id': '2' }, | ||
}) | ||
).toEqual({ | ||
find: "?users", | ||
find: '?users', | ||
where: [ | ||
["?users", "ref$users$bookshelves", "?bookshelves"], | ||
["?bookshelves", "ref$bookshelves$book_instances", "?book_instances"], | ||
["?book_instances", "ref$book_instances$books", "?books"], | ||
["2", "books/id", "?books"], | ||
['?users', 'ref$users$bookshelves', '?bookshelves'], | ||
['?bookshelves', 'ref$bookshelves$book_instances', '?book_instances'], | ||
['?book_instances', 'ref$book_instances$books', '?books'], | ||
['2', 'books/id', '?books'], | ||
], | ||
@@ -31,10 +38,10 @@ }); | ||
buildWhereQuery({ | ||
namespace: "bookshelves", | ||
where: { "_users.handle": "2" }, | ||
namespace: 'bookshelves', | ||
where: { '_users.handle': '2' }, | ||
}) | ||
).toEqual({ | ||
find: "?bookshelves", | ||
find: '?bookshelves', | ||
where: [ | ||
["?users", "ref$users$bookshelves", "?bookshelves"], | ||
["?users", "users/handle", "2"], | ||
['?users', 'ref$users$bookshelves', '?bookshelves'], | ||
['?users', 'users/handle', '2'], | ||
], | ||
@@ -44,3 +51,3 @@ }); | ||
test("Simple Query Without Where", () => { | ||
test('Simple Query Without Where', () => { | ||
expect( | ||
@@ -50,14 +57,14 @@ query({ users: {} }, db) | ||
.sort() | ||
).toEqual(["2", "3", "47", "622"]); | ||
).toEqual(['2', '3', '47', '622']); | ||
}); | ||
test("Simple Query With Where", () => { | ||
expect(query({ users: { $: { where: { handle: "stopa" } } } }, db)).toEqual({ | ||
test('Simple Query With Where', () => { | ||
expect(query({ users: { $: { where: { handle: 'stopa' } } } }, db)).toEqual({ | ||
users: [ | ||
{ | ||
createdAt: "2021-01-07 18:50:43.447955", | ||
email: "stepan.p@gmail.com", | ||
fullName: "Stepan Parunashvili", | ||
handle: "stopa", | ||
id: "2", | ||
createdAt: '2021-01-07 18:50:43.447955', | ||
email: 'stepan.p@gmail.com', | ||
fullName: 'Stepan Parunashvili', | ||
handle: 'stopa', | ||
id: '2', | ||
}, | ||
@@ -68,3 +75,3 @@ ], | ||
test("Simple Relation", () => { | ||
test('Simple Relation', () => { | ||
expect( | ||
@@ -74,3 +81,3 @@ query( | ||
users: { | ||
$: { where: { handle: "alex" } }, | ||
$: { where: { handle: 'alex' } }, | ||
bookshelves: {}, | ||
@@ -86,14 +93,14 @@ }, | ||
{ | ||
desc: "", | ||
id: "47-0", | ||
name: "Short Stories", | ||
desc: '', | ||
id: '47-0', | ||
name: 'Short Stories', | ||
order: 0, | ||
}, | ||
{ desc: "", id: "47-1", name: "Nonfiction", order: 1 }, | ||
{ desc: '', id: '47-1', name: 'Nonfiction', order: 1 }, | ||
], | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
@@ -104,3 +111,3 @@ ], | ||
test("Simple Inverse Relation", () => { | ||
test('Simple Inverse Relation', () => { | ||
expect( | ||
@@ -110,3 +117,3 @@ query( | ||
bookshelves: { | ||
$: { where: { "_users.handle": "alex" } }, | ||
$: { where: { '_users.handle': 'alex' } }, | ||
_users: {}, | ||
@@ -122,12 +129,12 @@ }, | ||
{ | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
], | ||
desc: "", | ||
id: "47-0", | ||
name: "Short Stories", | ||
desc: '', | ||
id: '47-0', | ||
name: 'Short Stories', | ||
order: 0, | ||
@@ -138,12 +145,12 @@ }, | ||
{ | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
], | ||
desc: "", | ||
id: "47-1", | ||
name: "Nonfiction", | ||
desc: '', | ||
id: '47-1', | ||
name: 'Nonfiction', | ||
order: 1, | ||
@@ -155,3 +162,3 @@ }, | ||
test("Nested Where", () => { | ||
test('Nested Where', () => { | ||
expect( | ||
@@ -161,5 +168,5 @@ query( | ||
users: { | ||
$: { where: { handle: "nicolegf" } }, | ||
$: { where: { handle: 'nicolegf' } }, | ||
bookshelves: { | ||
$: { where: { name: "Poetry" } }, | ||
$: { where: { name: 'Poetry' } }, | ||
}, | ||
@@ -173,8 +180,8 @@ }, | ||
{ | ||
bookshelves: [{ desc: "", id: "622-7", name: "Poetry", order: 7 }], | ||
createdAt: "2021-02-05 22:35:23.754264", | ||
email: "nicolegrf9@gmail.com", | ||
fullName: "Nicole Garcia Fischer", | ||
handle: "nicolegf", | ||
id: "622", | ||
bookshelves: [{ desc: '', id: '622-7', name: 'Poetry', order: 7 }], | ||
createdAt: '2021-02-05 22:35:23.754264', | ||
email: 'nicolegrf9@gmail.com', | ||
fullName: 'Nicole Garcia Fischer', | ||
handle: 'nicolegf', | ||
id: '622', | ||
}, | ||
@@ -185,5 +192,7 @@ ], | ||
test("Unbundled Links", () => { | ||
const db2 = createDB(zenecaTriples); | ||
save([["add-triple", "47-0", "ref$bookshelves$owner", "47"]], db2); | ||
test('Unbundled Links', () => { | ||
const db2 = transact( | ||
transform([tx.bookshelves['47-0'].link({ owner: '47' })], db), | ||
db | ||
); | ||
expect( | ||
@@ -193,3 +202,3 @@ query( | ||
bookshelves: { | ||
$: { where: { id: "47-0" } }, | ||
$: { where: { id: '47-0' } }, | ||
owner: { bookshelves: {} }, | ||
@@ -203,5 +212,5 @@ }, | ||
{ | ||
desc: "", | ||
id: "47-0", | ||
name: "Short Stories", | ||
desc: '', | ||
id: '47-0', | ||
name: 'Short Stories', | ||
order: 0, | ||
@@ -211,10 +220,10 @@ owner: [ | ||
bookshelves: [ | ||
{ desc: "", id: "47-0", name: "Short Stories", order: 0 }, | ||
{ desc: "", id: "47-1", name: "Nonfiction", order: 1 }, | ||
{ desc: '', id: '47-0', name: 'Short Stories', order: 0 }, | ||
{ desc: '', id: '47-1', name: 'Nonfiction', order: 1 }, | ||
], | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
@@ -227,5 +236,7 @@ ], | ||
test("Unbundled Links, Reverse Direction (through)", () => { | ||
const db2 = createDB(zenecaTriples); | ||
save([["add-triple", "47-0", "ref$bookshelves$owner", "47"]], db2); | ||
test('Unbundled Links, Reverse Direction (through)', () => { | ||
const db2 = transact( | ||
transform([tx.bookshelves['47-0'].link({ owner: '47' })]), | ||
db | ||
); | ||
expect( | ||
@@ -235,4 +246,4 @@ query( | ||
users: { | ||
$: { where: { id: "47" } }, | ||
_bookshelves: { $: { through: "owner" } }, | ||
$: { where: { id: '47' } }, | ||
_bookshelves: { $: { through: 'owner' } }, | ||
}, | ||
@@ -246,9 +257,9 @@ }, | ||
_bookshelves: [ | ||
{ desc: "", id: "47-0", name: "Short Stories", order: 0 }, | ||
{ desc: '', id: '47-0', name: 'Short Stories', order: 0 }, | ||
], | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
@@ -259,5 +270,7 @@ ], | ||
test("Aliasing (as)", () => { | ||
const db2 = createDB(zenecaTriples); | ||
save([["add-triple", "47-0", "ref$bookshelves$owner", "47"]], db2); | ||
test('Aliasing (as)', () => { | ||
const db2 = transact( | ||
transform([tx.bookshelves['47-0'].link({ owner: '47' })]), | ||
db | ||
); | ||
expect( | ||
@@ -267,4 +280,4 @@ query( | ||
users: { | ||
$: { where: { id: "47" } }, | ||
foo: { $: { through: "owner", is: "_bookshelves" } }, | ||
$: { where: { id: '47' } }, | ||
foo: { $: { through: 'owner', is: '_bookshelves' } }, | ||
}, | ||
@@ -277,8 +290,8 @@ }, | ||
{ | ||
foo: [{ desc: "", id: "47-0", name: "Short Stories", order: 0 }], | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
foo: [{ desc: '', id: '47-0', name: 'Short Stories', order: 0 }], | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
@@ -289,3 +302,3 @@ ], | ||
test("Cardinality for top-level object", () => { | ||
test('Cardinality for top-level object', () => { | ||
expect( | ||
@@ -296,5 +309,5 @@ query( | ||
$: { | ||
where: { id: "47-0" }, | ||
cardinality: "one", | ||
is: "bookshelves", | ||
where: { id: '47-0' }, | ||
cardinality: 'one', | ||
is: 'bookshelves', | ||
}, | ||
@@ -307,5 +320,5 @@ }, | ||
bookshelf: { | ||
desc: "", | ||
id: "47-0", | ||
name: "Short Stories", | ||
desc: '', | ||
id: '47-0', | ||
name: 'Short Stories', | ||
order: 0, | ||
@@ -316,3 +329,3 @@ }, | ||
test("Cardinality for nested object", () => { | ||
test('Cardinality for nested object', () => { | ||
expect( | ||
@@ -322,4 +335,4 @@ query( | ||
bookshelves: { | ||
$: { where: { id: "47-0" } }, | ||
owner: { $: { cardinality: "one", is: "_users" } }, | ||
$: { where: { id: '47-0' } }, | ||
owner: { $: { cardinality: 'one', is: '_users' } }, | ||
}, | ||
@@ -332,12 +345,12 @@ }, | ||
{ | ||
desc: "", | ||
id: "47-0", | ||
name: "Short Stories", | ||
desc: '', | ||
id: '47-0', | ||
name: 'Short Stories', | ||
order: 0, | ||
owner: { | ||
createdAt: "2021-01-09 18:53:07.993689", | ||
email: "reichertjalex@gmail.com", | ||
fullName: "Alex", | ||
handle: "alex", | ||
id: "47", | ||
createdAt: '2021-01-09 18:53:07.993689', | ||
email: 'reichertjalex@gmail.com', | ||
fullName: 'Alex', | ||
handle: 'alex', | ||
id: '47', | ||
}, | ||
@@ -349,12 +362,12 @@ }, | ||
test("enhanceWithDefaults", () => { | ||
test('enhanceWithDefaults', () => { | ||
expect( | ||
enhanceWithDefaults( | ||
{ | ||
users: { posts: { cardinality: "one" } }, | ||
posts: { comments: { where: { user: "foo" } } }, | ||
users: { posts: { cardinality: 'one' } }, | ||
posts: { comments: { where: { user: 'foo' } } }, | ||
}, | ||
{ | ||
users: { | ||
posts: { $: { where: { owner: "foo" } }, comments: {}, editors: {} }, | ||
posts: { $: { where: { owner: 'foo' } }, comments: {}, editors: {} }, | ||
}, | ||
@@ -366,4 +379,4 @@ } | ||
posts: { | ||
$: { where: { owner: "foo" }, cardinality: "one" }, | ||
comments: { $: { where: { user: "foo" } } }, | ||
$: { where: { owner: 'foo' }, cardinality: 'one' }, | ||
comments: { $: { where: { user: 'foo' } } }, | ||
editors: {}, | ||
@@ -370,0 +383,0 @@ }, |
// 1. patternMatch | ||
function isVariable(x) { | ||
return typeof x === "string" && x.startsWith("?"); | ||
return typeof x === 'string' && x.startsWith('?'); | ||
} | ||
@@ -6,0 +6,0 @@ |
@@ -1,1 +0,71 @@ | ||
export * from "./instant"; | ||
import { TransactionChunk } from './instatx'; | ||
import ReactiveDB, { Config, InstaQL } from './ReactiveDB'; | ||
import { assert } from './util/error'; | ||
import * as uuid from 'uuid'; | ||
import * as r from './react'; | ||
import * as instatx from './instatx'; | ||
import * as authAPI from './auth'; | ||
// ------ | ||
// Global | ||
let _GLOBAL_DB: ReactiveDB | null = null; | ||
function globalDBAsserting(): ReactiveDB { | ||
assert(_GLOBAL_DB != null, 'You must `init` first'); | ||
return _GLOBAL_DB; | ||
} | ||
// ----- | ||
// React | ||
export function id(): string { | ||
return uuid.v4(); | ||
} | ||
export function useQuery(q: InstaQL) { | ||
return r.useQuery(q, globalDBAsserting()); | ||
} | ||
export function useInit(config: Config) { | ||
if (!_GLOBAL_DB) { | ||
_GLOBAL_DB = new ReactiveDB(config); | ||
} | ||
return r.useInit(_GLOBAL_DB); | ||
} | ||
// ----- | ||
// Auth | ||
export const auth = { | ||
sendMagicCode({ email }: { email: string }) { | ||
const db = globalDBAsserting(); | ||
return authAPI.sendMagicCode({ | ||
apiURI: db.config.apiURI, | ||
appId: db.config.appId, | ||
email: email, | ||
}); | ||
}, | ||
verifyMagicCode({ email, code }: { email: string; code: string }) { | ||
const db = globalDBAsserting(); | ||
return authAPI.verifyMagicCode({ | ||
apiURI: db.config.apiURI, | ||
appId: db.config.appId, | ||
email, | ||
code, | ||
}); | ||
}, | ||
signOut() { | ||
const db = globalDBAsserting(); | ||
authAPI.signOut({ appId: db.config.appId }); | ||
}, | ||
}; | ||
// -------- | ||
// Transact | ||
export const tx = instatx.tx; | ||
export function transact(x: TransactionChunk | TransactionChunk[]) { | ||
globalDBAsserting().pushTx(x); | ||
} |
@@ -1,30 +0,36 @@ | ||
import * as datalog from "./datalog"; | ||
import * as datalog from './datalog'; | ||
import { getOps } from './instatx'; | ||
import { makeJoinAttr } from './instaql'; | ||
import { isAttrJoinFor, makeJoinAttr } from "./instaql"; | ||
function attrK(namespace, ident) { | ||
return `${namespace}/${ident}`; | ||
} | ||
function expandUpdate([namespace, eid, obj], db) { | ||
const triplesToAdd = Object.entries(obj) | ||
.map(([attr, v]) => [eid, `${namespace}/${attr}`, v]) | ||
.concat([[eid, `${namespace}/id`, eid]]); | ||
const attributeSet = new Set(triplesToAdd.map(([_, attr]) => attr)); | ||
const triplesToRemove = datalog | ||
.query( | ||
{ | ||
find: [eid, "?attr", "?v"], | ||
where: [[eid, "?attr", "?v"]], | ||
}, | ||
db | ||
) | ||
.filter(([_eid, attr]) => attributeSet.has(attr)); | ||
return triplesToRemove | ||
.sort() | ||
.map((triple) => ["retract-triple", ...triple]) | ||
.concat(triplesToAdd.sort().map((triple) => ["add-triple", ...triple])); | ||
const avs = Object.entries(obj) | ||
.concat([['id', eid]]) | ||
.sort(); | ||
const metaTriples = avs.flatMap(([ident, _]) => { | ||
const k = attrK(namespace, ident); | ||
return [ | ||
[k, 'db/namespace', namespace], | ||
[k, 'db/identity', ident], | ||
[k, 'db/valueType', 'blob'], | ||
[k, 'db/cardinality', 'one'], | ||
]; | ||
}); | ||
const objTriples = avs.map(([ident, v]) => [eid, attrK(namespace, ident), v]); | ||
return metaTriples.concat(objTriples).map((triple) => ['add', ...triple]); | ||
} | ||
function expandLink([namespaceA, aEid, v], db) { | ||
return Object.entries(v).flatMap(([namespaceB, bEid]) => { | ||
const trip = [aEid, makeJoinAttr(namespaceA, namespaceB), bEid]; | ||
const joinK = makeJoinAttr(namespaceA, namespaceB); | ||
const trip = [aEid, joinK, bEid]; | ||
return [ | ||
["retract-triple", ...trip], | ||
["add-triple", ...trip], | ||
['add', joinK, 'db/namespace', namespaceA], | ||
['add', joinK, 'db/identity', namespaceB], | ||
['add', joinK, 'db/valueType', 'ref'], | ||
['add', joinK, 'db/cardinality', 'many'], | ||
['add', ...trip], | ||
]; | ||
@@ -36,3 +42,3 @@ }); | ||
return Object.entries(v).map(([namespaceB, bEid]) => { | ||
return ["retract-triple", aEid, makeJoinAttr(namespaceA, namespaceB), bEid]; | ||
return ['retract', aEid, makeJoinAttr(namespaceA, namespaceB), bEid]; | ||
}); | ||
@@ -44,22 +50,21 @@ } | ||
{ | ||
find: [eid, "?attr", "?value"], | ||
where: [[eid, "?attr", "?value"]], | ||
find: [eid, '?attr', '?value'], | ||
where: [[eid, '?attr', '?value']], | ||
}, | ||
db | ||
); | ||
const refTriples = datalog | ||
.query( | ||
{ | ||
find: ["?eid", "?attr", eid], | ||
where: [["?eid", "?attr", eid]], | ||
}, | ||
db | ||
) | ||
.filter(([_eid, attr]) => { | ||
return isAttrJoinFor(attr, namespace); | ||
}); | ||
const refTriples = datalog.query( | ||
{ | ||
find: ['?eid', '?attr', eid], | ||
where: [ | ||
['?eid', '?attr', eid], | ||
['?attr', 'db/valueType', 'ref'], | ||
], | ||
}, | ||
db | ||
); | ||
return eidTriples | ||
.concat(refTriples) | ||
.sort() | ||
.map((trip) => ["retract-triple", ...trip]); | ||
.map((trip) => ['retract', ...trip]); | ||
} | ||
@@ -69,9 +74,9 @@ | ||
switch (action) { | ||
case "update": | ||
case 'update': | ||
return expandUpdate(args, db); | ||
case "link": | ||
case 'link': | ||
return expandLink(args, db); | ||
case "unlink": | ||
case 'unlink': | ||
return expandUnlink(args, db); | ||
case "delete": | ||
case 'delete': | ||
return expandDelete(args, db); | ||
@@ -83,45 +88,9 @@ default: | ||
// --- | ||
// tx | ||
const ops = { | ||
update(opts, v) { | ||
return ["update", opts.namespace, opts.id, v]; | ||
}, | ||
link(opts, v) { | ||
return ["link", opts.namespace, opts.id, v]; | ||
}, | ||
unlink(opts, v) { | ||
return ["unlink", opts.namespace, opts.id, v]; | ||
}, | ||
delete(opts, v) { | ||
return ["delete", opts.namespace, opts.id, v]; | ||
}, | ||
}; | ||
function createProxy(opts) { | ||
return new Proxy(opts, { | ||
get(target, k) { | ||
if (!opts.namespace) { | ||
return createProxy({ namespace: k, ...target }); | ||
} | ||
if (!opts.id) { | ||
return createProxy({ id: k, ...target }); | ||
} | ||
return ops[k].bind(null, target); | ||
}, | ||
}); | ||
} | ||
export const tx = createProxy({}); | ||
// --------- | ||
// transform | ||
export function isOp(x) { | ||
return Array.isArray(x) && typeof x[0] == "string"; | ||
} | ||
export function transform(txs, db) { | ||
return txs.flatMap((op) => toDatalogTransactions(op, db)); | ||
return txs | ||
.flatMap((tx) => getOps(tx)) | ||
.flatMap((op) => toDatalogTransactions(op, db)); | ||
} |
@@ -1,3 +0,3 @@ | ||
import * as datalog from "./datalog"; | ||
import intersection from "lodash/intersection"; | ||
import * as datalog from './datalog'; | ||
import intersection from 'lodash/intersection'; | ||
@@ -9,3 +9,3 @@ function makeVar(k) { | ||
function isReverseRelation(x) { | ||
return x.startsWith("_"); | ||
return x.startsWith('_'); | ||
} | ||
@@ -24,6 +24,2 @@ | ||
export function isAttrJoinFor(attr, namespaceB) { | ||
return attr.startsWith("ref$") && attr.endsWith(`$${namespaceB}`); | ||
} | ||
export function makeJoinAttr(namespaceA, namespaceB) { | ||
@@ -56,3 +52,3 @@ return `ref$${namespaceA}$${namespaceB}`; | ||
function makeFinalWhereForm(namespace, attr, v) { | ||
if (attr === "id") { | ||
if (attr === 'id') { | ||
return [v, `${datalogNamespace(namespace)}/id`, makeVar(namespace)]; | ||
@@ -64,3 +60,3 @@ } | ||
function buildDatalogWhere(ks, v, ret = []) { | ||
if (ks.length <= 1) throw new Error("unbalanced dot syntax"); | ||
if (ks.length <= 1) throw new Error('unbalanced dot syntax'); | ||
if (ks.length === 2) { | ||
@@ -84,3 +80,3 @@ const [namespace, attr] = ks; | ||
? clauses.flatMap(([k, v]) => { | ||
return buildDatalogWhere([namespace].concat(k.split(".")), v); | ||
return buildDatalogWhere([namespace].concat(k.split('.')), v); | ||
}) | ||
@@ -93,15 +89,11 @@ : [[topVar, `${datalogNamespace(namespace)}/id`, `?$v`]], | ||
return { | ||
find: [eid, "?attr", "?val"], | ||
where: [[eid, "?attr", "?val"]], | ||
find: ['?ident', '?val'], | ||
where: [ | ||
[eid, '?attrK', '?val'], | ||
['?attrK', 'db/valueType', 'blob'], | ||
['?attrK', 'db/identity', '?ident'], | ||
], | ||
}; | ||
} | ||
function attrTupsToMap(attrTups) { | ||
return attrTups.reduce((acc, [_, attr, v]) => { | ||
const [_namespace, k] = attr.split("/"); | ||
acc[k] = v; | ||
return acc; | ||
}, {}); | ||
} | ||
function makeFindRefQuery(from, fromEid, to) { | ||
@@ -114,8 +106,4 @@ return { | ||
function hackFilterForJustAttribute(tups) { | ||
return tups.filter(([_, attr]) => !attr.startsWith("ref$")); | ||
} | ||
function getConnections(form) { | ||
return Object.keys(form).filter((x) => x !== "$"); | ||
return Object.keys(form).filter((x) => x !== '$'); | ||
} | ||
@@ -135,4 +123,13 @@ | ||
function namespaceForEid(eid, db) { | ||
const [[_, x]] = getAttrTups(eid, db); | ||
return x.split("/")[0]; | ||
const [namespace] = datalog.query( | ||
{ | ||
find: '?namespace', | ||
where: [ | ||
[eid, '?attrK', eid], | ||
['?attrK', 'db/namespace', '?namespace'], | ||
], | ||
}, | ||
db | ||
); | ||
return namespace; | ||
} | ||
@@ -164,8 +161,12 @@ | ||
function getAttrTups(eid, db) { | ||
return hackFilterForJustAttribute(datalog.query(buildAttrTupQuery(eid), db)); | ||
function attrMap(eid, db) { | ||
const avs = datalog.query(buildAttrTupQuery(eid), db); | ||
return avs.reduce((acc, [ident, v]) => { | ||
acc[ident] = v; | ||
return acc; | ||
}, {}); | ||
} | ||
function modifyWithCardinality(objs, query) { | ||
if (query.$?.cardinality === "one") { | ||
if (query.$?.cardinality === 'one') { | ||
return objs[0]; | ||
@@ -177,4 +178,3 @@ } | ||
function expandSelect({ namespace, query, db, eid }) { | ||
const attrTups = getAttrTups(eid, db); | ||
const m = attrTupsToMap(attrTups); | ||
const m = attrMap(eid, db); | ||
const connections = getConnections(query); | ||
@@ -181,0 +181,0 @@ connections.forEach((connection) => { |
{ | ||
"name": "instant-local-throwaway", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "This is an experiment for instant", | ||
@@ -32,5 +32,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"uuid": "^8.3.2", | ||
"lodash": "^4.17.21" | ||
"immer": "^9.0.14", | ||
"lodash": "^4.17.21", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
73
854349
4
17216
+ Addedimmer@^9.0.14
+ Addedimmer@9.0.21(transitive)