Thellmann / callimachus

Automatically exported from code.google.com/p/callimachus
Other
0 stars 0 forks source link

Single required relationship on related resource causes empty result #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When using markup like the following the first relationships becomes required 
for the rest of the document.

<label class="input" rel="msg:realm" resource="?realm">
<input type="radio" name="realm" checked="checked" />
<span rel="rdf:type" resource="/callimachus/Manifest">Protected</span>
</label>

The produced SPARQL does not close the ?realm resource scope until the end of 
the query, as show here. The ?reader variable should not be nested in the 
?realm block.

 UNION
 {
  ?this msg:realm ?realm .
  ?realm a </callimachus/Manifest> .
  OPTIONAL {
  }
  OPTIONAL {
   {
    ?this calli:reader ?reader .
    ?reader a calli:Party .
    OPTIONAL {
     {
      ?this calli:reader ?reader .
      OPTIONAL {
       ?reader rdfs:label ?_reader_label .
      }
     }
    }
   }
   UNION

Adding an optional pattern (such as rdfs:label) to the ?realm resource corrects 
the block nesting, but should not be required.

Original issue reported on code.google.com by ja...@3roundstones.com on 14 Oct 2011 at 1:32

GoogleCodeExporter commented 9 years ago
Similar things can happen when constructing a dynamic dropzone. Drag/upload a 
photo in the dropzone below will not link to the image, but if the img tag has 
a title="{rdfs:label}" it will work.

    <form id="form" method="POST" action="" enctype="application/sparql-update" about="?this">
        <div dropzone="link s:text/uri-list">
            <label>Photo <a href="?create=/callimachus/Photo" onclick="return calli.createResource(this)" class="ui-icon ui-icon-newwin"/></label>
            <div rel="foaf:img">
                <span about="?img" typeof="foaf:Image" class="ui-state-highlight ui-corner-all">
                    <img src="{?img}?small" />
                    <a href="{?img}" onclick="return calli.removeResource(this)" class="ui-icon ui-icon-close" />
                </span>
            </div>
        </div>
        <button type="submit">Save</button>
        <button type="button" onclick="location.replace('?view')">Cancel</button>
    </form>

Original comment by ja...@3roundstones.com on 12 Mar 2012 at 3:07