<!-- for annotated version see: https://raw.githubusercontent.com/ietf-tools/rfcxml-templates-and-schemas/main/draft-rfcxml-general-template-annotated-00.xml -->
XR Fragments allows us to enrich existing dataformats, by recursive use of existing proven technologies like <ahref="https://en.wikipedia.org/wiki/URI_fragment">URI Fragments</a> and BibTags notation.<br></p>
<li>addressibility and navigation of 3D scenes/objects: <ahref="https://en.wikipedia.org/wiki/URI_fragment">URI Fragments</a> + src/href spatial metadata</li>
<li>hasslefree tagging across text and spatial objects using <ahref="https://github.com/coderofsalvation/tagbibs">bibs</a> / <ahref="https://en.wikipedia.org/wiki/BibTeX">BibTags</a> appendices (see <ahref="https://visual-meta.info">visual-meta</a> e.g.)</li>
<p>Let’s always focus on average humans: our fuzzy symbolical mind must be served first, before serving a greater <ahref="https://en.wikipedia.org/wiki/Borg">categorized typesafe RDF hive mind</a>).</p>
<p>Popular compatible 3D fileformats: <code>.gltf</code>, <code>.obj</code>, <code>.fbx</code>, <code>.usdz</code>, <code>.json</code> (THREE.js), <code>.dae</code> and so on.</p>
In case of <code>buttonA</code> the end-user will be teleported to another location and time in the <strong>current loaded scene</strong>, but <code>buttonB</code> will
<p>Here’s an ascii representation of a 3D scene-graph with 3D objects <code>◻</code> which embeds remote & local 3D objects <code>◻</code> with/out using queries:</p>
<p>An XR Fragment-compatible browser viewing this scene, lazy-loads and projects <code>painting.png</code> onto the (plane) object called <code>canvas</code> (which is copy-instanced in the bed and livingroom).<br>
Also, after lazy-loading <code>ocean.com/aquarium.gltf</code>, only the queried objects <code>bass</code> and <code>tuna</code> will be instanced inside <code>aquariumcube</code>.<br>
<h1id="xr-fragment-queries">XR Fragment queries</h1>
<p>Include, exclude, hide/shows objects using space-separated strings:</p>
<ul>
<li><code>#q=cube</code></li>
<li><code>#q=cube -ball_inside_cube</code></li>
<li><code>#q=* -sky</code></li>
<li><code>#q=-.language .english</code></li>
<li><code>#q=cube&rot=0,90,0</code></li>
<li><code>#q=price:>2 price:<5</code></li>
</ul>
<p>It’s simple but powerful syntax which allows <b>css</b>-like class/id-selectors with a searchengine prompt-style feeling:</p>
<ol>
<li>queries are showing/hiding objects <strong>only</strong> when defined as <code>src</code> value (prevents sharing of scene-tampered URL’s).</li>
<li>queries are highlighting objects when defined in the top-Level (browser) URL (bar).</li>
<li>search words like <code>cube</code> and <code>foo</code> in <code>#q=cube foo</code> are matched against 3D object names or custom metadata-key(values)</li>
<li>search words like <code>cube</code> and <code>foo</code> in <code>#q=cube foo</code> are matched against tags (BibTeX) inside plaintext <code>src</code> values like <code>@cube{redcube, ...</code> e.g.</li>
<li><code>#</code> equals <code>#q=*</code></li>
<li>words starting with <code>.</code> like <code>.german</code> match class-metadata of 3D objects like <code>"class":"german"</code></li>
<li>words starting with <code>.</code> like <code>.german</code> match class-metadata of (BibTeX) tags in XR Text objects like <code>@german{KarlHeinz, ...</code> e.g.</li>
</ol>
<blockquote>
<p><strong>For example</strong>: <code>#q=.foo</code> is a shorthand for <code>#q=class:foo</code>, which will select objects with custom property <code>class</code>:<code>foo</code>. Just a simple <code>#q=cube</code> will simply select an object named <code>cube</code>.</p>
</blockquote>
<ul>
<li>see <ahref="https://coderofsalvation.github.io/xrfragment.media/queries.mp4">an example video here</a></li>
<td>select all objects (only useful in <code>src</code> custom property)</td>
</tr>
<tr>
<td><code>-</code></td>
<td>removes/hides object(s)</td>
</tr>
<tr>
<td><code>:</code></td>
<td>indicates an object-embedded custom property key/value</td>
</tr>
<tr>
<td><code>.</code></td>
<td>alias for <code>"class" :".foo"</code> equals <code>class:foo</code></td>
</tr>
<tr>
<td><code>></code><code><</code></td>
<td>compare float or int number</td>
</tr>
<tr>
<td><code>/</code></td>
<td>reference to root-scene.<br>Useful in case of (preventing) showing/hiding objects in nested scenes (instanced by <code>src</code>) (*)</td>
</tr>
</tbody>
</table>
<blockquote>
<p>* = <code>#q=-/cube</code> hides object <code>cube</code> only in the root-scene (not nested <code>cube</code> objects)<br><code>#q=-cube</code> hides both object <code>cube</code> in the root-scene <b>AND</b> nested <code>skybox</code> objects |</p>
</blockquote>
<p><ahref="https://github.com/coderofsalvation/xrfragment/blob/main/src/3rd/js/three/xrf/q.js">» example implementation</a>
<ahref="https://github.com/coderofsalvation/xrfragment/blob/main/example/assets/query.gltf#L192">» example 3D asset</a>
<li>create an associative array/object to store query-arguments as objects</li>
<li>detect object id’s & properties <code>foo:1</code> and <code>foo</code> (reference regex: <code>/^.*:[><=!]?/</code> )</li>
<li>detect excluders like <code>-foo</code>,<code>-foo:1</code>,<code>-.foo</code>,<code>-/foo</code> (reference regex: <code>/^-/</code> )</li>
<li>detect root selectors like <code>/foo</code> (reference regex: <code>/^[-]?\//</code> )</li>
<li>detect class selectors like <code>.foo</code> (reference regex: <code>/^[-]?class$/</code> )</li>
<li>detect number values like <code>foo:1</code> (reference regex: <code>/^[0-9\.]+$/</code> )</li>
<li>expand aliases like <code>.foo</code> into <code>class:foo</code></li>
<li>for every query token split string on <code>:</code></li>
<li>create an empty array <code>rules</code></li>
<li>then strip key-operator: convert “-foo” into “foo”</li>
<li>add operator and value to rule-array</li>
<li>therefore we we set <code>id</code> to <code>true</code> or <code>false</code> (false=excluder <code>-</code>)</li>
<li>and we set <code>root</code> to <code>true</code> or <code>false</code> (true=<code>/</code> root selector is present)</li>
<li>we convert key ‘/foo’ into ‘foo’</li>
<li>finally we add the key/value to the store like <code>store.foo = {id:false,root:true}</code> e.g.</li>
</ol>
<blockquote>
<p>An example query-parser (which compiles to many languages) can be <ahref="https://github.com/coderofsalvation/xrfragment/blob/main/src/xrfragment/Query.hx">found here</a></p>
</blockquote>
<h2id="xr-fragment-uri-grammar">XR Fragment URI Grammar</h2>
<li>XR Fragments allows <bid="tagging-text">hasslefree spatial tagging</b>, by detecting BibTeX metadata <strong>at the end of content</strong> of text (see default mimetype & Data URI)</li>
<li>XR Fragments allows <bid="tagging-objects">hasslefree spatial tagging</b>, by treating 3D object name/class-pairs as BibTeX tags.</li>
<li>BibTex & Hashtagbibs are the first-choice <strong>requestless metadata</strong>-layer for XR text, HTML/RDF/JSON is great (but fits better in the application-layer)</li>
<li>Default font (unless specified otherwise) is a modern monospace font, for maximized tabular expressiveness (see <ahref="#core-principle">the core principle</a>).</li>
<li>anti-pattern: hardcoupling a mandatory <strong>obtrusive markuplanguage</strong> or framework with an XR browsers (HTML/VRML/Javascript) (see <ahref="#core-principle">the core principle</a>)</li>
<li>anti-pattern: limiting human introspection, by immediately funneling human thought into typesafe, precise, pre-categorized metadata like RDF (see <ahref="#core-principle">the core principle</a>)</li>
<p>BibTex (generated from 3D objects), can be extended by the enduser with personal BiBTex or <ahref="https://github.com/coderofsalvation/hashtagbibs">hashtagbibs</a>.</p>
<p><ahref="https://github.com/coderofsalvation/hashtagbibs">hashtagbibs</a> allows the enduser to add ‘postit’ connections (compressed BibTex) by speaking/typing/scanning text, which the XR Browser saves to remotestorage (or localStorage per toplevel URL). As well as, referencing BibTags per URI later on: <code>https://y.io/z.fbx#@baroque@todo</code> e.g.</p>
<td>spatial object(s) with name <code>baroque</code> or <code>"class":"house"</code> are now automatically tagged with ‘house’ (incl. child nodes)</td>
<td>text- or spatial-object(s) (non-descendant nodes) elsewhere, (class)named ‘baroque’ or ‘house’, are automatically tagged with ‘house’ (current node to root nodes)</td>
<td>text- or spatial-object(s) (non-descendant nodes) elsewhere, (class)named ‘baroque’ or ‘house’, are automatically tagged with ‘house’ (too node to all nodes)</td>
<td>text- or spatial-object(s) (non-descendant nodes) elsewhere, (class)named ‘baroque’ or ‘house’, are automatically tagged with ‘house’ (too node to all nodes)</td>
<p>BibTex allows the enduser to adjust different levels of associations (see <ahref="#core-principle">the core principle</a>): spatial wires can be rendered, words can be highlighted, spatial objects can be highlighted/moved/scaled, links can be manipulated by the user.<br></p>
<p>NOTE: infinite matches both ‘baroque’ and ‘style’-occurences in text, as well as spatial objects with <code>"class":"style"</code> or name “baroque”. This multiplexing of id/category is deliberate because of <ahref="#core-principle">the core principle</a>.</p>
<li>The XR Browser needs to adjust tag-scope based on the endusers needs/focus (infinite tagging only makes sense when environment is scaled down significantly)</li>
<li>The XR Browser should always allow the human to view/edit the metadata, by clicking ‘toggle metadata’ on the ‘back’ (contextmenu e.g.) of any XR text, anywhere anytime.</li>
<p>The simplicity of appending BibTeX (and leveling the metadata-playfield between humans and machines) is also demonstrated by <ahref="https://visual-meta.info">visual-meta</a> in greater detail.</p>
<li><ahref="https://github.com/coderofsalvation/hashtagbibs">hashtagbibs</a> are expanded to <ahref="https://en.wikipedia.org/wiki/BibTeX">bibtags</a></li>
<li>lines matching regex <code>^@</code> will automatically get filtered out, in order to:</li>
<li>links between textual/spatial objects can automatically be detected</li>
<li>bibtag appendices (<ahref="https://visual-meta.info">visual-meta</a> can be interpreted e.g.</li>
<p>This significantly expands expressiveness and portability of human tagged text, by <strong>postponing machine-concerns to the end of the human text</strong> in contrast to literal interweaving of content and markupsymbols (or extra network requests, webservices e.g.).</p>
<p>additional tagging using <ahref="https://github.com/coderofsalvation/hashtagbibs">bibs</a>: to tag spatial object <code>note_canvas</code> with ‘todo’, the enduser can type or speak <code>@note_canvas@todo</code></p>
BibTeX-appendices are already used in the digital AND physical world (academic books, <ahref="https://visual-meta.info">visual-meta</a>), perhaps due to its terseness & simplicity.<br>
<p>To keep XR Fragments a lightweight spec, BibTeX is used for rudimentary text/spatial tagging (not JSON, RDF or a scripting language because they’re harder to write/speak/repair.).</p>
<p>Of course, on an application-level JSON(LD / RDF) can still be used at will, by embedding RDF-urls/data as custom properties (but is not interpreted by this spec).</p>
<li>Respect hashtag(bibs) and rulers (like <code>${visual-meta-start}</code>) according to the <ahref="https://github.com/coderofsalvation/hashtagbibs">hashtagbibs spec</a></li>
<p>when an XR browser updates the human text, a quick scan for nonmatching tags (<code>@book{nonmatchingbook</code> e.g.) should be performed and prompt the enduser for deleting them.</p>