{"id":41,"date":"2005-04-01T04:10:18","date_gmt":"2005-04-01T10:10:18","guid":{"rendered":"http:\/\/www.ourada.org\/blog\/archives\/41"},"modified":"2005-04-01T04:10:18","modified_gmt":"2005-04-01T10:10:18","slug":"slots-vs-members","status":"publish","type":"post","link":"https:\/\/www.ourada.org\/blog\/archives\/41","title":{"rendered":"Slots vs. Members"},"content":{"rendered":"<p>(OK, now, this is an article about data structure design, not some euphemistic battle of some genders.)<\/p>\n<p>(Are open-Internet confessions of ignorance really a good idea? I only post such a thing in the hopes that someone may find it useful as a bridge to some subject they hadn&#8217;t though about before. In this case, if you&#8217;re a &#8216;programmer&#8217;, maybe you haven&#8217;t though much about &#8216;knowledge bases&#8217; before.)<\/p>\n<p>In messing around with <a href=\"http:\/\/protege.stanford.edu\/\">Prot\u00e9g\u00e9<\/a>, I&#8217;m learning about the knowledge-base concept of slots versus the programming concept of members. Please keep in mind in that I still haven&#8217;t bothered to even read the Prot\u00e9g\u00e9 project&#8217;s no-doubt-excellent <a href=\"http:\/\/protege.stanford.edu\/publications\/ontology_development\/ontology101.html\">tutorial on ontology design<\/a>, nor any books on knowledge-bases, -capture, -management, etc., though I really will some day. Anyway, for the purposes of this article I&#8217;m just a software developer who happens to have stumbled upon an interesting tool.<\/p>\n<p>Many popular programming languages (C, Java, Python, etc.) have a simple mechanism by which you can create your own application-specific types. You create classes\/structs that have members, like so*:<br \/>\n<code><br \/>\nstruct HairInfo<br \/>\n{<br \/>\n\tfloat Length;<br \/>\n\tfloat CurlFactor;<br \/>\n\t...<br \/>\n}<br \/>\n<\/code><\/p>\n<p>If you had another struct<br \/>\n<code><br \/>\nstruct String<br \/>\n{<br \/>\n\tfloat Length;<br \/>\n\tchar *Str;<br \/>\n\t...<br \/>\n}<br \/>\n<\/code><\/p>\n<p>the two &#8216;Length&#8217; members would not conflict with one another because they&#8217;re in different namespaces. One would tend not to think of them as being related in any very deep manner. In fact, if you wanted to represent the fact that the members _were_ deeply related, you&#8217;d probably create a new type to use instead of &#8216;float&#8217;, and use that type for both members.<\/p>\n<p>In the Prot\u00e9g\u00e9 world, trying to create two &#8216;members&#8217; with the same name _will_ lead to a conflict. Cuz you&#8217;re not creating members, you&#8217;re creating slots, and those all live in the same namespace. Which seems weird, coming from classes&#8217;n&#8217;members background. Members are pieces of an object; slots are descriptions attached to an object.<\/p>\n<p>Prot\u00e9g\u00e9 does it this way, I&#8217;m guessing (because I haven&#8217;t actually read), to add an additional dimension of semantic richness to knowledge structures. This concept is also found in another topic I don&#8217;t know enough about, <a href=\"http:\/\/www.w3.org\/RDF\/\">RDF<\/a>\/Semantic Web, where there&#8217;s a (universal) namespace of <em>predicates<\/em>. The point is that, for example, you may be able to apply the predicate &#8216;creator&#8217; to a book, a web page, a magazine, a tree, etc., and that in a connected world, you can search the world for, say, &#8220;creator=&#8217;Steven Ourada'&#8221; and find all the things someone claims I created, without having to know beforehand to what sorts of things that predicate might be attached.<\/p>\n<p>So a system like Prot\u00e9g\u00e9 shares predicates, or descriptors, or slots, or whatever, rather than types. That&#8217;s interesting. That&#8217;s my only point.<\/p>\n<p>* A long time ago, I shared space (in a rented <a href=\"http:\/\/www.modspace.com\/\">GE trailer<\/a>. Did you know GE rents trailers for temporary office space? I did not know that before I worked in one.) at <a href=\"http:\/\/www.eai.com\/\">Engineering Animation Inc. (EAI)<\/a> (I wish the Wayback Machine kept images. How useful is <a href=\"http:\/\/web.archive.org\/web\/19971210104021\/http:\/\/www.eai.com\/\">this<\/a>?) with the <a href=\"http:\/\/www.amazon.com\/exec\/obidos\/tg\/detail\/-\/B00000JLRD\/103-8077912-7687021?v=glance\">Barbie Magic Hairstyler<\/a> team. One of the things I remember hearing people talk about was the HairInfo struct. This is by far not the oddest thing I ever heard in that trailer, but it still sticks out.<\/p>\n<p>In case you want to know more about the making of Barbie Magic Hairstyler, contact <a href=\"http:\/\/www.sannier.net\/acesblog\/\">Adrian Sannier<\/a>. Yeah, I didn&#8217;t think so.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(OK, now, this is an article about data structure design, not some euphemistic battle of some genders.) (Are open-Internet confessions of ignorance really a good idea? I only post such a thing in the hopes that someone may find it useful as a bridge to some subject they hadn&#8217;t though about before. In this case, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-general","author-admin"],"_links":{"self":[{"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ourada.org\/blog\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}