You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just getting to grips with Spira and I've found something that strikes me as odd (the mailing list looks a bit quiet so I'm posting here instead). I wonder if this is an expectation set by the OOP/ ActiveRecord world that simply doesn't apply in the graph/ RDF world...
I expect Spira::Base#count to return the count of objects of the relevant type - i.e. the distinct count of "?s a <model_type>", the number of instances. Instead #count returns the count of occurrences of those subjects - i.e. the number of triples where a "?s a <model_type>" is the subject. In OOP terms this is basically like counting the number of attributes which is certainly not what I would expect.
I realise that what might need 'fixing' is in fact my expectations about how objects work in a graph world. If so, I'd be very grateful if someone could elaborate on this.
Nevertheless the apparent congruence between the AR and Spira public APIs leads me to believe that I won't be the only one making this mistake! It might be clearer, for example, if Spira distinguished between a #count and a #count_of_subjects method.
The text was updated successfully, but these errors were encountered:
I agree with you here. However, it should be noted that there are two count methods defined for Spira::Base: a class method and an instance method. I believe, Spira::Base.count (class method) should return the number of "model types" (and it actually says so). Spira::Base#count returns "the number of RDF::Statements this projection has" (looks to be implemented properly).
So, if Spira::Base.count does not work as expected, there's definitely a bug there. Please make sure you're using the correct "count" ;-) Does Spira::Base.count work for you?
Speaking of the congruence between AR and Spira, you'd also call ActiveRecord::Base.count to count the records in the DB, not (non-existant) ActiveRecord::Base#count.
I'm just getting to grips with Spira and I've found something that strikes me as odd (the mailing list looks a bit quiet so I'm posting here instead). I wonder if this is an expectation set by the OOP/ ActiveRecord world that simply doesn't apply in the graph/ RDF world...
I expect Spira::Base#count to return the count of objects of the relevant type - i.e. the distinct count of "?s a <model_type>", the number of instances. Instead #count returns the count of occurrences of those subjects - i.e. the number of triples where a "?s a <model_type>" is the subject. In OOP terms this is basically like counting the number of attributes which is certainly not what I would expect.
I realise that what might need 'fixing' is in fact my expectations about how objects work in a graph world. If so, I'd be very grateful if someone could elaborate on this.
Nevertheless the apparent congruence between the AR and Spira public APIs leads me to believe that I won't be the only one making this mistake! It might be clearer, for example, if Spira distinguished between a
#count
and a#count_of_subjects
method.The text was updated successfully, but these errors were encountered: