Question

I try to fill a repeater control's datasource through the following VB code :

    Dim queryString As SparqlParameterizedString = New SparqlParameterizedString()
    For Each nsPrefix In UrlManager.namespaces.Keys
        queryString.Namespaces.AddNamespace(nsPrefix, New Uri(UrlManager.namespaces(nsPrefix)))
    Next
    queryString.CommandText = commandText
    Dim parser As New SparqlQueryParser()
    Dim query = parser.ParseFromString(queryString)
    Dim r As SparqlResultSet = g.ExecuteQuery(query)
    If r.Count > 0 Then
        datasource = r
    Else
        datasource = Nothing
    End If

where variable g is my working graph

I work with the same query

SELECT DISTINCT ?context ?label { 
    ?s a my:Client . 
    ?s rdfs:label ?label . 
    BIND ( IF(EXISTS {?s rdf:type my:Subscriber}, 1, 0)  AS ?priority ) 
} ORDER BY DESC(?priority) ASC(?label)

Whenever I try this vb code in a simple aspx page, it works correctly but if fails on the repeater OnLoad event with a VDS.RDF.Query.RdfQueryException: Cannot add a Set to the Null Multiset

It seems the error is caused by the BIND ( IF(EXISTS {?s rdf:type my:Subscriber}, 1, 0) AS ?priority ) clause: if I remove it, my repeater behaves as expected!

Any idea why the exception occurs and how to correct it ?

Was it helpful?

Solution

This may be related to the bug identified by your related question (Sparql issue on BIND clause)

There was a bug in EXISTS when it was used as the child of another expression, if you are able to build from source yourself you will be able to check whether that fix resolves this issue. If you still encounter a problem please file a new bug in the Issue Tracker

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top