This project has moved. For the latest updates, please go here.

Delete patterns bug

Apr 3, 2014 at 8:28 AM
Given context has a ":default" graph as updateGraph and datasetgraph.
In case of a delete where an entity has IEntity: IBase, so 2 types, then the generated delete patterns are ( is B wildcard):
id a :Entity
id a :Base
* * id
* * id
where patterns 3,4 are to delete triples where :id is an object.
In SparqlUpdatable store "FormatDeletePattern" does not replace subject so this results in
WITH <http://www.example.com/default> 
DELETE {   <http://www.brightstardb.com/.well-known/model/wildcard> ?d2 ?d3 . } 
WHERE {   <http://www.brightstardb.com/.well-known/model/wildcard> ?d2 ?d3 . };
To fix this i've changed the code so it replaces any wildcard regardless of position:
 private static string FormatDeletePattern(Triple p, ref int propId)
        {
            return String.Format("  {0} {1} {2} .", 
                FormatElement(p.Subject, ref propId),
                FormatElement(p.Predicate, ref propId),
                FormatElement(p.Object, ref propId));

//            return p.Predicate.Equals(Constants.WildcardUri)
//                       ? String.Format("  <{0}> ?d{1} ?d{2} .", p.Subject, propId++, propId++)
//                       : String.Format("  <{0}> <{1}> ?d{2} .", p.Subject, p.Predicate, propId++);
        }

        private static string FormatElement(string element, ref int propId)
        {
            return element.Equals(Constants.WildcardUri)
                ? String.Format("?d{0}", propId++)
                : String.Format("<{0}>", element);
        }
Coordinator
Apr 3, 2014 at 7:56 PM
Thanks for the report. I've pushed a fix to develop.