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
|
4 |
+
<meta charset="utf-8"/>
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
+
<link rel="canonical" href="https://memelang.net/05/" />
|
7 |
+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
8 |
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
9 |
+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
10 |
+
<title>Memelang</title>
|
11 |
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
12 |
+
|
13 |
+
<style type="text/css">
|
14 |
+
body { line-height:150%; background:rgb(11,12,13); color:rgb(230,230,230); font-family:sans-serif; font-size:1.1rem; margin:40px 10px 100px 10px; }
|
15 |
+
a { color:rgb(170,170,192); text-decoration:none; }
|
16 |
+
a:hover { text-decoration:underline; }
|
17 |
+
main { max-width: 700px; width: 94%; margin:0 auto; }
|
18 |
+
h1 { font-size:2rem; margin:0 0 20px 0 }
|
19 |
+
h3 { font-size:1.2rem; margin:40px 0 0 0 }
|
20 |
+
ul { padding-left:20px; }
|
21 |
+
ul li { margin-bottom:8px }
|
22 |
+
code { font-family:monospace; font-size: 1rem; padding:1px 3px; background:rgba(255,255,255,0.1); white-space:nowrap; }
|
23 |
+
pre { background:rgba(255,255,255,0.1); font-family:monospace; box-sizing:border-box; width:100%; margin-block-end:2em; padding:12px 16px; vertical-align:top; overflow:auto; }
|
24 |
+
pre code { padding:0; background:none; white-space:pre }
|
25 |
+
.msg { text-align:center; color:rgb(255,128,0); font-weight:bold; font-style:italic; padding:20px; background:rgb(100,50,21); display:block; margin-bottom:40px; }
|
26 |
+
</style>
|
27 |
+
|
28 |
+
</head>
|
29 |
+
<body>
|
30 |
+
<a href="#"
|
31 |
+
onclick="navigator.clipboard.writeText(TEXT);this.style.transform='scale(.9)';setTimeout(()=>this.style.transform='scale(1.2)',100);setTimeout(()=>this.style.transform='scale(1)',200);return false"
|
32 |
+
style="transition:transform .2s;position: absolute; top:0; right:2%; border-radius:0 0 4px 4px; padding:10px 20px;background:rgb(43,43,60);text-decoration: none;color:rgb(213,213,240);font-weight: bold; font-size:0.8rem">COPY for AI</a>
|
33 |
+
<article id="content" class="markdown-body" style="max-width: 900px;margin: 0 auto;">
|
34 |
+
# Memelang v5
|
35 |
+
|
36 |
+
Memelang is an concise query language for structured data, knowledge graphs, retrieval-augmented generation, and semantic data. See the [Python GitHub repository](https://github.com/memelang-net/memesql5/).
|
37 |
+
|
38 |
+
### Memes
|
39 |
+
|
40 |
+
A meme comprises key-value pairs separated by spaces, starting with `m=int`, and ending with a semicolon. A meme is analogous to a relational database row.
|
41 |
+
|
42 |
+
```
|
43 |
+
m=123 R1=A1 R2=A2 R3=A3;
|
44 |
+
```
|
45 |
+
|
46 |
+
* ***M-identifier***: an arbitrary integer in the form `m=123`, analogous to a primary key
|
47 |
+
* ***R-relation***: an alphanumeric key analogous to a database column
|
48 |
+
* ***A-value***: an integer, decimal, or string analogous to a database cell value
|
49 |
+
* Non-alphanumeric strings are double-quoted, with CSV-style quote escaping `="John ""Jack"" Kennedy"`
|
50 |
+
* Comments are prefixed with double forward slashes `//`
|
51 |
+
|
52 |
+
```
|
53 |
+
// Example memes for the Star Wars cast
|
54 |
+
m=123 actor="Mark Hamill" role="Luke Skywalker" movie="Star Wars" rating=4.5;
|
55 |
+
m=456 actor="Harrison Ford" role="Han Solo" movie="Star Wars" rating=4.6;
|
56 |
+
m=789 actor="Carrie Fisher" role=Leia movie="Star Wars" rating=4.2;
|
57 |
+
```
|
58 |
+
|
59 |
+
### Queries
|
60 |
+
|
61 |
+
Queries are partial memes with empty parts as wildcards:
|
62 |
+
* Empty A-values retrieve all values for the specified R-relation
|
63 |
+
* Empty R-relations retrieve all relations for the specified A-value
|
64 |
+
* Empty R-relations and A-values (` = `) retrieve all pairs in the meme
|
65 |
+
|
66 |
+
```
|
67 |
+
// Query for all movies with Mark Hamill as an actor
|
68 |
+
actor="Mark Hamill" movie=;
|
69 |
+
|
70 |
+
// Query for all relations involving Mark Hamill
|
71 |
+
="Mark Hamill";
|
72 |
+
|
73 |
+
// Query for all relations and values from all memes relating to Mark Hamill:
|
74 |
+
="Mark Hamill" =;
|
75 |
+
```
|
76 |
+
|
77 |
+
A-value operators:
|
78 |
+
* String: `=`, `!=`
|
79 |
+
* Numerics: `=`, `!=`, `>`, `>=`, `<`, `<=`
|
80 |
+
|
81 |
+
```
|
82 |
+
firstName=Joe;
|
83 |
+
lastName!="David-Smith";
|
84 |
+
height>=1.6;
|
85 |
+
width<2;
|
86 |
+
weight!=150;
|
87 |
+
```
|
88 |
+
|
89 |
+
Comma-separated values produce an ***OR*** list:
|
90 |
+
|
91 |
+
```
|
92 |
+
// Query for (actor OR producer) = (Mark OR "Mark Hamill")
|
93 |
+
actor,producer=Mark,"Mark Hamill"
|
94 |
+
```
|
95 |
+
|
96 |
+
R-relation operators:
|
97 |
+
* `!` negates the relation name
|
98 |
+
|
99 |
+
```
|
100 |
+
// Query for Mark Hamill's non-acting relations
|
101 |
+
!actor="Mark Hamill";
|
102 |
+
|
103 |
+
// Query for an actor who is not Mark Hamill
|
104 |
+
actor!="Mark Hamill";
|
105 |
+
|
106 |
+
// Query all relations excluding actor and producer for Mark Hamill
|
107 |
+
!actor,producer="Mark Hamill"
|
108 |
+
```
|
109 |
+
|
110 |
+
|
111 |
+
### A-Joins
|
112 |
+
|
113 |
+
Open brackets `R1[R2` join memes with equal `R1` and `R2` A-values. Open brackets need **not** be closed, a semicolon closes all brackets.
|
114 |
+
|
115 |
+
```
|
116 |
+
// Generic example
|
117 |
+
R1=A1 R2[R3 R4>A4 A5=;
|
118 |
+
|
119 |
+
// Query for all of Mark Hamill's costars
|
120 |
+
actor="Mark Hamill" movie[movie actor=;
|
121 |
+
|
122 |
+
// Query for all movies in which both Mark Hamill and Carrie Fisher act together
|
123 |
+
actor="Mark Hamill" movie[movie actor="Carrie Fisher";
|
124 |
+
|
125 |
+
// Query for anyone who is both an actor and a producer
|
126 |
+
actor[producer;
|
127 |
+
|
128 |
+
// Query for a second cousin: child's parent's cousin's child
|
129 |
+
child= parent[cousin parent[child;
|
130 |
+
|
131 |
+
// Join any A-Value from the present meme to that A-Value in another meme
|
132 |
+
R1=A1 [ R2=A2
|
133 |
+
```
|
134 |
+
|
135 |
+
Joined queries return one meme with multiple `m=` M-identifiers. Each `R=A` belongs to the preceding `m=` meme.
|
136 |
+
|
137 |
+
```
|
138 |
+
m=123 actor="Mark Hamill" movie="Star Wars" m=456 movie="Star Wars" actor="Harrison Ford";
|
139 |
+
```
|
140 |
+
|
141 |
+
### Variables
|
142 |
+
|
143 |
+
R-relations and A-values may be certain variable symbols. Variables *cannot* be inside quotes.
|
144 |
+
|
145 |
+
* `@` Last matching A‑value
|
146 |
+
* `%` Last matching R‑relation
|
147 |
+
* `#` Current M-identifier
|
148 |
+
|
149 |
+
```
|
150 |
+
// Join two different memes where R1 and R2 have the same A-value (equivalent to R1[R2)
|
151 |
+
R1= m!=# R2=@;
|
152 |
+
|
153 |
+
// Two different R-relations have the same A-value
|
154 |
+
R1= R2=@;
|
155 |
+
|
156 |
+
// The first A-value is the second R-relation
|
157 |
+
R1= @=A2;
|
158 |
+
|
159 |
+
// The first R-relation equals the second A-value
|
160 |
+
=A1 R2=%;
|
161 |
+
|
162 |
+
// The pattern is run twice (redundant)
|
163 |
+
R1=A1 %=@;
|
164 |
+
|
165 |
+
// The second A-value may be Jeff or the previous A-value
|
166 |
+
R1=A1 R2=Jeff,@;
|
167 |
+
```
|
168 |
+
|
169 |
+
### M-Joins
|
170 |
+
|
171 |
+
Explicit joins are controlled using `m` and `#`.
|
172 |
+
|
173 |
+
* `m=#` present meme (implicit default)
|
174 |
+
* `m!=#` join to a different meme
|
175 |
+
* `m= ` join to any meme (including the present)
|
176 |
+
* `m=^#` (or `]`) resets `m` and `#` to the *previous* meme, acts as *un*join
|
177 |
+
|
178 |
+
```
|
179 |
+
// Join two different memes where R1 and R2 have the same A-value (equivalent to R1[R2)
|
180 |
+
R1= m!=# R2=@;
|
181 |
+
|
182 |
+
// Join any memes (including the present one) where R1 and R2 have the same A-value
|
183 |
+
R1= m= R2=@;
|
184 |
+
|
185 |
+
// Join two different memes, unjoin, join a third meme (equivalent statements)
|
186 |
+
R1[R2] R3[R4;
|
187 |
+
R1= m!=# R2=@ m=^# R3= m!=# R4=@;
|
188 |
+
|
189 |
+
// Unjoins may be sequential (equivalent statements)
|
190 |
+
R1[R2 R3[R4]] R5=;
|
191 |
+
R1= m!=# R2=@ R3= m!=# R4=@ m=^# m=^# R5=;
|
192 |
+
R1= m!=# R2=@ R3= m!=# R4=@ m=^# ] R5=;
|
193 |
+
R1= m!=# R2=@ R3= m!=# R4=@ ]] R5=;
|
194 |
+
|
195 |
+
// Join two different memes on R1=R2, unjoin, then join the first meme to another where R4=R5
|
196 |
+
R1= m!=# R2=@ R3= m=^# R4= m!=# R5=@;
|
197 |
+
|
198 |
+
// Query for a meta-meme, R2's A-value is R1's M-identifier
|
199 |
+
R1=A1 m= R2=#
|
200 |
+
```
|
201 |
+
|
202 |
+
### About
|
203 |
+
|
204 |
+
Memelang was created by [Bri Holt](https://en.wikipedia.org/wiki/Bri_Holt) and first disclosed in a [2023 U.S. Provisional Patent application](https://patents.google.com/patent/US20250068615A1). ©2025 HOLTWORK LLC. Contact [info@memelang.net](mailto:info@memelang.net).
|
205 |
+
</article>
|
206 |
+
|
207 |
+
<script type="text/javascript">
|
208 |
+
const TEXT = document.getElementById('content').textContent
|
209 |
+
document.getElementById('content').innerHTML =
|
210 |
+
marked.parse(TEXT);
|
211 |
+
</script>
|
212 |
+
|
213 |
+
</body>
|
214 |
+
</html>
|