When using the Consolidate Results option I get Fatal error: Unsupported operand types in plugins/sparql_views_plugin_query_sparql.inc on line 337.

I have a patch to fix this which I'll post up in a minute.

Comments

stuartraetaylor’s picture

Status: Active » Needs review
StatusFileSize
new1.4 KB

I've updated sparql_views_plugin_query_sparql.inc to fix the original error, and also updated sparql_views_handler_field.inc to fix a bug rendering optional fields when using consolidate results.

Anonymous’s picture

StatusFileSize
new1.9 KB

Thanks for posting the issue and the patch.

It looks like I never updated this bit of code for the new version. TBH, I hate having to do anything with it because it is so complex. When I tried the patch, it made it so all of the results had all of the values from the other subjects.

I managed to get it working for my use case. There were some errors as I went along. One of the errors comes from having a subject in the query but not having the subject URI chosen as a field. To prevent this error, at least one subject URI must be included in the selected fields.

Another problem is when you have multiple subjects in the query. If you want to consolidate all values on a single resource, this patch allows you to do that. You have to have the resource's subject URI field chosen but not the other subject URIs.

This will fail for more complex queries, but it's good enough for me for now. Better consolidation might have to wait until subqueries in SPARQL 1.1.

If you have the chance to test it with your use case, please post and let me know if it worked. FYI, I'll probably commit it if I don't hear back in a few days.