jwagenaar / HDS-Toolbox

Hierarchical Data Storage Toolbox for Matlab
http://jwagenaar.github.com/HDS-Toolbox/
GNU General Public License v3.0
5 stars 0 forks source link

Potential bug with @HDS/remlink.m #7

Open ghost opened 12 years ago

ghost commented 12 years ago

Hi there again. I've been playing around with links in the HDS Toolbox, which I've found very useful as a semi-network model database extension of a hierarchical database management system like HDS Toolbox. Anyway, I believe I found a very small bug in the method remlink of the HDS class. The bug is on lines 38 to 39 of the remlink.m file, which are shown here.

assert(obj.linkPropIds(2, propId), ['Property %s contains child objects which '...
    'can only be removed using the REMOBJ method'],upper(propName));

Whenever I call the remlink method for a given object containing a link, I receive the following error printed to the command window:

Error using assert
The condition input argument must be a scalar logical.
Error in HDS/remlink (line 38)
  assert(obj.linkPropIds(2, propId), ['Property %s contains child objects which '... 

Firstly, it appears that assert is not automatically converting obj.linkPropIds(2, propId) to the logical built-in data type. Secondly, from looking through the remobj file and the HDS class definition file, it appears that the fix is to convert the first argument to type logical and add the NOT or ~ logical operator in front of the argument as shown below.

assert(~logical(obj.linkPropIds(2, propId)), ['Property %s contains child objects which '...
    'can only be removed using the REMOBJ method'],upper(propName));

This fix allowed me to remove links without any problems. That being said, I didn't spend the time to scrutinize the code and so your input would be greatly appreciated if I didn't take something into account. Cheers!

jwagenaar commented 12 years ago

Thanks! I will look at soon. In the meantime, I added a Wiki page that outlines some of the structures and the contents of the BIN file in case you are interested in it. I think it should be up to date .

ghost commented 12 years ago

Good stuff. Thanks for the Wiki. I'll take a look at it. Also, I was playing around with links a lot more and really like their functionality. Since two objects can be made to refer to each other or an object to itself, the HDS Toolbox has the ability to add a lot more network data model enhancements almost to the point that it could be considered an object-oriented network DBMS (database management system). Take a look at this: http://www.levmuchnik.net/Content/Networks/ComplexNetworksPackage.htmlhttp://www.levmuchnik.net/Content/Networks/ComplexNetworksPackage.html. It is a toolbox for looking at complex networks and some of its functionality could be useful for generalizing HDS Toolbox for really complicated data models. My work for example is frustrating in that two objects can have "ownership" of each other and so the network data model is very useful. No urgent hurry on my part to implement something like this as I'm focusing on time series analysis right now and HDS is perfect in that case. Thanks for the message and Wiki. Have a great day!

Reid

On Thu, Nov 22, 2012 at 3:20 AM, Joost Wagenaar notifications@github.comwrote:

Thanks! I will look at soon. In the meantime, I added a Wiki page that outlines some of the structures and the contents of the BIN file in case you are interested in it. I think it should be up to date .

— Reply to this email directly or view it on GitHubhttps://github.com/jwagenaar/HDS-Toolbox/issues/7#issuecomment-10610546.

Reid Frasier +852-6070-8751 reid.frasier@gmail.com