On 2010-02-15 06.18, Stanislav Muhametsin wrote:
After couple hours of googling about SPARQL (only known it before as acronym), looking at SPARQL queries produced by Qi4j logging, and examining values.dat of the rdf indexing, I noticed that collection properties are stored as plain strings. So, in order to produce SPARQL query which could implement containsAll (and contains) functionality, using regexes seemed like appropriate solution.
Yeah, ManyAssociations we can break up into RDF collections, but so far property collections have been stringified. We *could*, I think, do a breakup into RDF collections there as well, although not sure how to do it generically.
One problem with regexes in Sesame is that it will be linear searches. So probably quite slow, unfortunately.
One thing still left me puzzling a little: I couldn't find code, which actually produces the string which can be found in values.dat. Because there it is without _type keys for value composites, and everything seemed to use valueType.toJSON method, which always produces the _type -key there. I partly copypasted code from there in order to produce appropriate regex strings.
If you have a Property<List<String>> the serialization is going to be handled by CollectionType. _type is only needed if the collection type is anything other than "List" "Set" or "Collection". For those we will use default implementations so no need to add the _type.
Also there was API change to QueryExpressions: public static <T> ContainsAllPredicate<T> containsAll(Property<Collection<T>> proeprty, Collection<T> value) to: public static <T, C extends Collection<T>> ContainsAllPredicate<T, C> containsAll( Property<C> property, C value )
Apart from the typo it looks ok to me.
so that it is no longer needed to cast property type into parameterless one in order to avoid compilation error. And changes propagated further onto ContainsAllPredicate (and ContainsPredicate), as can be seen. The PropertyReferenceImpl couldn't understand the parametrized collections, so I fixed that one too. RdfQueryParserImpl changes are obvious - that's the place where the abstract query gets parsed into SPARQL one, so that one contains most of the code changes.
Excellent! As for getting it in, Niclas already sent instructions on that. /Rickard _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

