[topicmapmail] Topicmaps and LINQ ??

Thompson, Miles MThompson at creditsights.com
Fri May 18 04:58:34 EDT 2007


Hello all,

No answers here, just questions.

I wonder if anyone out there in TopicMap world has been thinking about
whether TopicMaps is a fit (or not!) for the LINQ
<http://msdn2.microsoft.com/en-us/netframework/aa904594> style syntax
that seems to be the latest trendy thing in programming.

Just to give an idea what I'm talking about consider that...
--
..the following code snippet is NOT SQL this is pure C# (3) code.

var productGroups = 
   from p in products 
    group p by p.Category into g 
    where g.Group.Any(p => p.UnitsInStock == 0) 
    select new {Category = g.Key, Products = g.Group}; 

--
And here's a sample from JavaFX Script, Sun's new scripting language..

var titleTracks =
  select indexof track + 1 from album in albums,
    track in album.tracks where track == album.title;

--

I'm not really smart enough to see whether it would be possible to write
a converter to would link up LINQ to TopicMaps, but I bet some of you
out there must've been thinking about it. If so, what are your thoughts.

--

Apparently C# "LINQ" syntax can made to interact with data stored in all
sorts of data formats simply by writing the relevant mapping/conversion
layer - with the first implementations being for SQL databases (DLinq),
XML documents (XLink) and in memory datasets.

I think it involves setting up lamda expressions or "expression trees"
or something... 

But even though I (clearly) have no idea what I'm talking about I can't
help but imagine how neat it would to interact with TopicMaps in this
kind of way - especially so if you had a totally dynamically typed
language. Maybe you could do some kind of thing so that the TopicType
names automagically map to the things that look like 'table' names in
expressions like the above??

As Anders Hejlsberg says "of course, you could do this previously... but
its very clunky and indirect... and by the time you are done it, it no
longer looks like a query - right, I mean you may have abstractly in
your head imagined a query but certainly looking at the code you don't
see it any longer... but if you remove all the housekeeping and fluff,
then out of the fog emerges .. this illusion of a query language -
constructed as an API.."

--

So what do you say out there?

Even if you don't have any definitive answers, I for one would love to
hear any initial reactions or speculations.


I found the following great interview with Anders Hejlsberg (from
somewhere north of Poland! ;-) to be very informative on this subject
(and in this he does talk about deferred execution and ways to make it
not so horrendously inefficient as it looks like it would be at first)

http://blogs.msdn.com/charlie/archive/2007/01/26/anders-hejlsberg-on-lin
q-and-functional-programming.aspx

As he says "its not like we invented all this, we just came up with a
new way to put it together.."

--

Thanks for your thoughts (if any)

Miles Thompson
Sentient Sentient
CreditSights Inc

 


More information about the topicmapmail mailing list