Sunday, October 23, 2011

Common Lisp example code for my Semantic Web book is now LGPL licensed

A few days ago I re-released the Java, JRuby, Clojure, and Scala example code for my JVM languages edition of my Semantic Web book under the LGPL.

I just did the same thing today for the Common Lisp edition of this book:

Github repository

Thursday, October 20, 2011

Changed license from AGPLv3 to LGPLv3 for example code in my book "Practical Semantic Web and Linked Data Applications, Java, Scala, Clojure, and JRuby Edition"

Here is the github repository for the source code and all required libraries.

My open content web page" where you can download a free PDF for my book or follow the link to Lulu to buy a print version.


Semantic Web, Web 3.0, and composable systems

I really enjoyed Steve Yegge's long post last week about the shortcomings of Google's architecture. Google provides great services that I use every day but building systems as Amazon does of composable web services (AWS) to build more complex products and services seems like a better approach.

I have been experimenting with Semantic Web (SW) technologies since reading Tim Berners-Lee, James Hendler, and Ora Lassila's 2001 Scientific American article. I have not often had customer interest in using Semantic Web technologies and I think that I am starting to understand why people miss the value-add:

Just as AWS provides composable web services SW helps information providers to provide structured and semantically meaningful data to customers and users who decide what information to fetch, as they need it. These consumers of SW data sources must have a much higher skill set to build automated systems compared to a user of the web who manually navigates around the web to find information that they need.

So I think that the issue becomes how can to make it relatively easy for system designers and software engineers to fetch and consume information. The easy answer is to point them to a good book on SPARQL and RDF data sources. A better answer is probably to provide examples using common programming languages, the "best" libraires for making SPARQL queries, and small sample applications tailored to the types of data that an information provider provides and what type of inferencing makes sense to discover implicit data that is not explicitly in the provider's data store.

I would describe the SW as building and using composable data sources that are defined in terms of ontology's that make it possible to merge data from different sources and to discover implicit data through inference/reasoning.

Wednesday, October 19, 2011

A letter to my friends and family: the death of American democracy: not dying, but already dead

Hello family and friends,

Democracy in our country is dead, but you would not know it from reading the highly censored corporate-owned and controlled "news"/propaganda media.

If you look to foreign news or youtube or the general Internet or talk to friends in foreign countries that have a free press, you will understand that is is not rank and file cops, but their supervisors commiting what I think can only be called illegal brutality against the "occupy" movement.

The high-ranking police do this because they are ordered by their puppet-masters to do so. There is a huge disparity between what the general public wants and what the corporate lackeys in Congress and the corporate lackey Obama (following in the ubber corporate lackey W.Bush's footsteps) do. As Warren Buffet said in a recent interview, the USA is now a plutocracy, and that is a shame. Good writeup on a writer's arrest: I enjoy Naomi Wolf's work - a writer with reasonable views.

Our founding fathers warned us about banks and control of currency, control by the rich, etc. taking control of our country, but the right-wing extremists have removed civics from school curriculums, used total control of the media to scare people into giving up their rights as American citizens, and acted against the common good.

One Republican agenda is to make it difficult for the poor, the elderly without transportation, and students to register to vote, and their anti American "values" disgust me. Anyone who has anything to do with keeping American citizens from voting by making registration more difficult is an asshole. These are people who don't understand what our country is supposed to represent, or don't care.

One last comment: the un-educated are most easily swayed by right-wing propaganda, which is why I believe that our educational system has been deconstructed by those on the far right politically.

It is time for people who have self-identified as republicans and conservatives to speak up against the un-American right wingers who corrupt our political system. Barry Goldwater had great conservative ideals which I largely agree with, but I bet he is rolling in his grave in disgust by the current bunch of "conservatives."

Wednesday, October 05, 2011

Appreciating Steve Jobs and the people taking part in "Occupy Wall Street"

First: my condolences to Steve Job's family and friends. He was an awesome guy who lived on his own terms and made the world a better place by doing things that he loved and was proud of.

I would also like to give a shout out of appreciation to the broad spectrum of Americans who are taking part in "Occupy Wall Street." They are facing state sponsored brutality: the elite class doesn't like the legal protests so they put pressure on the government and government influences police to do things that in their hearts they know are not right. I have been reading a lot of strong criticism of the police for their brutality in New York City against mostly peaceful American citizens exercising their first amendment rights - I personally try to not blame the police because I think it is more accurate to blame the people who control them. There are shocking videos on youtube of police brutality against US citizens in New York City during these protests and I thought about putting some links here, but these videos are violent and may be upsetting to many people.

The erosion of rights for American citizens is shocking even though I have been watching the same thing happening already in England so I have been expecting a similar collapse of basic American rights and values in favor of the powerful.

Sunday, October 02, 2011

Experimenting with Clojure 1.3 and Noir 1.2

Noir is a Clojure "mini framework" that is built on top of Compojure. Chris Granger released a new version today that is updated for Clojure 1.3. After working mostly in Clojure last year but using Clojure not very much this year (lots of work for a Java shop) I decided to check out both Clojure 1.3 and Noir 1.2 this afternoon - and I liked what I saw.

The Noir example application uses a recent version of clj-stacktrace and stack traces are much better: Noir prints a well formatted stack trace on any generated web page if an error occurs. This stack trace is very good, filtering out information that you really don't want to see, identifying where the error occurred, and with usually a useful error message.

This eliminates the only major complaint I have ever had with Clojure. Very cool!

The Noir web site had a link to an article written by Ignacio Thayer on running a Clojure Noir MongoDB app on Heroku, using a free MongoDB account. Worked great. I made a trivial change to src/noir_mongo_heroku/views/welcome.clj to also work with a local MongoDB service:
 (let [mongo-url (get (System/getenv) "MONGOHQ_URL")]
   (if mongo-url
     (let [config    (split-mongo-url mongo-url)]
       (mongo! :db (:db config)
               :host (:host config)
               :port (Integer. (:port config)))
       (authenticate (:user config) (:pass config)))
     (mongo! :db "db"))
Noir roughly supplies the same general level of functionality as Sinatra. Noir's development environment, like Compojure that it is layered on, supports live code reloading so if you are used to an interactive dev style like that of Rails and Sinatra, and if you like Lisp (:-) then give it a try.

I am an old Lisp hacker, starting with Lisp on a Dec 10, and getting my first Lisp Machine in 1982. I think that Lisp (Common Lisp, Scheme, Clojure, etc.) mostly appeals to those of us who would (mostly) like to build up our own infrastructure. I say this even though some Lisps have huge libraries: Franz Lisp, Racket, Clojure (both good native libraries and stuff inherited from Java-land), etc. are certainly "batteries included" languages/platforms, but I still characterize Lisp'ers as build it ourselves types.

JPA 2 is the only part of Java EE 6 that I like a lot - how it compares to ActiveRecord

First, in Ruby-land: I am a huge fan of both Datamapper and ActiveRecord. Here I am only going to talk about ActiveRecord because it is freshest for me because I have been reading through a few Rails specific books that Obie Fernandez's publisher Addison-Wesley sent me review copies of earlier this year: these books use ActiveRecord 3.*. Recently I created two small throw-away learning apps using Rails 3.1 to kick the tires on new features and I used ActiveRecord for each.

One of my customers is a Java EE 6 shop (although we now do use SmartGWT for web apps) and I have been using JPA 2 (Hibernate provider) a lot. In Java-land, I can't imagine using anything else to access relational databases unless you want to use the Hibernate APIs directly, and I would not be inclined to walk that path.

I used to approach object modeling and design differently in Ruby: I would usually start with a relational database and use ActiveRecord's (fairly) automatically generated wrapping APIs. I now think that this is a generally "less good" approach (unless you are using a large legacy database) and now I start with generating models and migrations for the first cut of my object models and then use new migrations to manage changes to my models' schemas. Perhaps a small difference, but I am happier thinking about Ruby model classes than database schema.

So, my development approach is now very similar to using Ruby+ActiveRecord and Java+JPA 2.

My belief is that it is much faster to do object modeling and data persistence, including time for changing object models and associated business logic in Ruby and ActiveRecord. Not even the most die-hard Java developers should seriously argue with this. Given more expensive development in Java + JPA 2, I think that it is worthwhile listing some things I like less about ActiveRecord:
  1. It is more difficult to read code and understand the models because access methods are not defined in the code. For example, if a class User has a many to many relationship with the class Project, evaluating something like (User.first.public_methods - Object.methods).sort will indeed show that ActiveRecord provides a method projects that returns an array off associated projects. However, if you don't know the conventions that ActiveRecord uses for inherited class methods like has_and_belongs_to_many, has_many, belongs_to, etc. then reading other people's code may be confusing. I find that navigating large numbers of JPA annotated model classes in a good IDE like IntelliJ is quick and makes understanding a very large codebase manageable.
  2. A quick 100 hour reading of the Hibernate Reference Manual shows more capability and options than I am aware of in ActiveRecord.
  3. For large "enterprise" applications where increased cost of development does not matter as much, the availability of off shelf distributed caching options and other highly scalable infrastructure components favors, in my opinion, the Java platform.
That said, valid counter arguments are:
  1. The learning curve for ActiveRecord is relatively small so after writing a few complete web applications a developer will know most of what they need and well written Rails apps should be easy to read and understand. I also find that reading though large Rails applications using RubyMine provides almost as good of a developer experience as working with large Java projects with IntelliJ.
  2. Most Java developers will never need to use most of what JPA 2 and Hibernate offer.
  3. Worrying about very large scale optimization is almost always a premature optimization. I am reading a great book "The Lean Startup" that makes this point very well: avoid making very long term plans, instead favoring short iterations of planning, measuring, then pivot or keep the current plan.
One thing that I believe that both JPA 2 and ActiveRecord do very well is managing transitive relationships. Both can be set to perform cascading deletes, etc. I think that JPA 2 and Hibernate offer a finer control for maintaining associations between objects but for my work I have found ActiveRecord to always be adequate.

I enjoy using both ActiveRecord and JPA 2 enough that I don't really care which platform my customers prefer, and I almost never try to talk my customers into switching away from their platform of choice.