Forum: Ruby Suggestion for Ruby quiz

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
itsme213 (Guest)
on 2006-03-24 17:24
(Received via mailing list)
Integration of OWL with Ruby

######################

OWL (Web Ontology Language) has several interesting capabilities,
including:
- Define a (possibly anonymous) class using property expressions
   DarkChocolate = Dark & base_material is a Chocolate
   Dark = (any Thing) with brightness = Low
- Class definition can be incremental and federated
   Vehicle = ....
   ...
   Vehicle = ....
- Classification
   Determine if arbitrary object is member of class by checking
properties
- Equivalent | Disjoint | ...
   Assert that two separately defined classes always | never have the
same
members
- First-class properties
   Properties are applicable to independent classes (duck typing)
   Properties are namespaced (Ruby 2 forthcoming selector namespace)
- Numerous tools
   There are many (open-source) tools that handle OWL ontologies
- Formal interpretation
   Maps to RDF tuples (subject-predicate-object)
   Makes many (open-source) formal analysis tools applicable

Tons of info on OWL on the web. One tutorial at
http://www.cs.man.ac.uk/~horrocks/ISWC2003/Tutorial/

######################

A deep integration of OWL with Ruby would be interesting and potentially
very useful:
 - opening up new kinds of expressiveness in Ruby
 - allowing all of Ruby's power in manipulating OWL
 - opening access to OWL and RDF tools.

One might even find some intriguing links between some of OWL's features
and
Ruby with duck typing, open classes, method_missing, dynamic mix-ins,
etc.
(See http://gigaton.thoughtworks.net/~ofernand1/DeepInt...)

An example of integrating OWL and Ruby, adapted from the above URL:

class TeachersChild < OWL::Thing

  defined_with_query some_expression_or_block_or_string

  def misbehave
    raise "Teacher's kids never misbehave"
  end

end

obj1 = OWL::Thing.new (properties which may qualify as TeachersChild)

obj1.misbehave # dynamically pick up TeachersChild#misbehave

ExternalOWLTool.process obj1 # external reasoning tools

######################

There may be some useful Ruby resources already available based on work
by
Rich Kilmer.
www.daml.org/meetings/2004/05/pi/pdf/InfoEther-Semitar.pdf
James G. (Guest)
on 2006-03-24 18:36
(Received via mailing list)
On Mar 24, 2006, at 9:23 AM, itsme213 wrote:

> Integration of OWL with Ruby

This is an interesting idea.

My only concern is:  how much work is involved?  (I honestly have no
idea.)  Does someone want to email me an implementation off-list with
details of how long it took you?  Could we maybe choose a subset of
functionality that could be accomplished fairly quickly?

James Edward G. II
Caleb C. (Guest)
on 2006-03-25 02:04
(Received via mailing list)
On 3/24/06, itsme213 <removed_email_address@domain.invalid> wrote:
> Integration of OWL with Ruby
>
> ######################
>
> OWL (Web Ontology Language) has several interesting capabilities, including:

Aside from the quizzy possibilities, you've made me curious about OWL
itself. I've never heard of OWL before, but it seems pretty
interesting. I'm trying to learn more now. Part of my interest is that
OWL resembles in some ways my pattern-matching language, Reg. It seems
that they address somewhat different areas, but there is perhaps quite
a lot of overlap.

From what I'm seeing right now, OWL is, unfortunately, XML-based.

> - Define a (possibly anonymous) class using property expressions
>    DarkChocolate = Dark & base_material is a Chocolate
>    Dark = (any Thing) with brightness = Low

So, in Reg this might be:

Dark = item_that.brightness==Low
DarkChocolate = item_that.base_material.is_a?(Chocolate) & Dark

alternately:

DarkChocolate = -{:brightness=>Low, :base_material=>Chocolate}

> - Class definition can be incremental and federated
>    Vehicle = ....
>    ...
>    Vehicle = ....

Uhh, you left too much out for me to make much sense of this.... but
it sounds like Ruby's open classes?

> - Classification
>    Determine if arbitrary object is member of class by checking properties

How would this differ from the DarkChocolate example above?

> - Equivalent | Disjoint | ...
>    Assert that two separately defined classes always | never have the same
> members

It sounds cool. And I have absolutely no idea how it could be done in my
system.

> Tons of info on OWL on the web. One tutorial at
> http://www.cs.man.ac.uk/~horrocks/ISWC2003/Tutorial/

A page full of links to powerpoint and pdf files. I'm too ill today to
want to deal with that.... maybe tomorrow. I'll google about a bit for
this.

>   def misbehave
>     raise "Teacher's kids never misbehave"
>   end
>
> end
>
> obj1 = OWL::Thing.new (properties which may qualify as TeachersChild)
>
> obj1.misbehave # dynamically pick up TeachersChild#misbehave
>
> ExternalOWLTool.process obj1 # external reasoning tools

In Reg, classes (in the OO sense) and patterns (queries on objects)
aren't the same thing. So, this example really blows my mind. This is
really cool, and I like it. But I'm a bit unclear about this line:

obj1.misbehave

Am I correct in assuming that it raises the exception if
TeachersChild===obj1? If so, then what happens if obj1 is also a
ProblemChild that (mis)behaves differently?
Wilson B. (Guest)
on 2006-03-25 03:41
(Received via mailing list)
On 3/24/06, Caleb C. <removed_email_address@domain.invalid> wrote:
> OWL resembles in some ways my pattern-matching language, Reg. It seems
> that they address somewhat different areas, but there is perhaps quite
> a lot of overlap.

Check out Obie's work-in-progress on this topic. Very cool:
"Deep Integration of Ruby with Semantic Web Ontologies"
http://gigaton.thoughtworks.net/~ofernand1/DeepInt...
This topic is locked and can not be replied to.