Virtual mapping empty cell becomes triple

Today I used virtual mappings via Stardog Studio, which works great! However, I struggle with empty cells. These become triples as well, which I try to prevent. So for example:

I have a row in postgresql:

12323455;name of object; description for object;;lat;long;;;;last part of information

This results in:

http://data.example.com/object/12323455 rdfs:label "name of object"
http://data.example.com/object/12323455 rdfs:description "description for object"
http://data.example.com/object/12323455 ex:prop1 ""
http://data.example.com/object/12323455 geo:lat "4.545646546"
http://data.example.com/object/12323455 geo:long "52.545646546"
http://data.example.com/object/12323455 ex:prop2 ""
http://data.example.com/object/12323455 ex:prop3 ""
http://data.example.com/object/12323455 ex:prop4 ""
http://data.example.com/object/12323455 rdfs:note "last part of information"

Is this the expected behaviour? If so, is there a possibility to get rid of the empty properties?

This is the expected behavior if by "empty cell" you mean non-null empty string values. You can filter these out in your mapping with a SQL query:

select * from table
where prop2 <> '' and prop3 <> ''

Best,
Jess

It just makes for a much longer mapping file depending on on the number of "empty cells" you've got. I'd be interested in knowing what the performance implications would be. Would that result in more db queries? I'm assuming you'd still want the other columns mapped when they are empty.

There is an unavoidable overhead in filtering data, whether it's done in the source system or in Stardog. While I agree that it makes the mapping more complicated, adding anything more than an "ignore empty strings" options to Stardog would also need to be declared in the mapping. That is, we would expose a generic facility for making these types of transformations. Looking back the proper solution would be more like:

select case when prop2 = '' then NULL else prop2 end as prop2 ....

This would preserve the row in the result and the virtual mapping would not return triples for NULL values.

Jess

With "empty" I actually meant NULL values. I might see the problem. I use PGAdmin for managing the database which shows null and empty values in the same way. I just ran some queries which shows that it are not NULL values but literally empty values ' '.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.