- From: Leo Sauermann <leo@gnowsis.com>
- Date: Sat, 4 Oct 2003 12:12:45 +0200
- To: "'Graham Klyne'" <gk@ninebynine.org>, <www-rdf-interest@w3.org>
Hi Graham,
I have to admit that I don't understand exactly what your question is
but I see some things I recognize.
> What are alternative viewpoints concerning the role of
> dataytypes in RDF?
From my Jena experience I can tell you that the things you are doing are
sophisticated. In jena/java there is a rulesystem that inferences
new triples, it has functional features like "sum", "greater than" etc
you may program more.
Example of rules :
-> (rdf:type rdfs:range rdfs:Class).
[rdf1and4: (?x ?p ?y) -> (?p rdf:type rdf:Property), (?x rdf:type
rdfs:Resource), (?y rdf:type rdfs:Resource)]
[rdfs7b: (?a rdf:type rdfs:Class) -> (?a rdfs:subClassOf rdfs:Resource)]
The rules are evaluated in Java code that is Datatype sensitive:
Here is the implementation of the "sum" functionality,
but keep in mind that this is a Java class that is compiled
and interpretetd by parser/reasoner engine,
I don't know exactly how this works (Dave Reynolds does, I think)
Interesting code from com.hp.hpl.jena.reasoner.rulesys.builtins.Sum
Object v1 = n1.getLiteral().getValue();
Object v2 = n2.getLiteral().getValue();
Node sum = null;
if (v1 instanceof Number && v2 instanceof Number) {
Number nv1 = (Number)v1;
Number nv2 = (Number)v2;
if (v1 instanceof Float || v1 instanceof Double
|| v2 instanceof Float || v2 instanceof Double) {
sum = Util.makeDoubleNode(nv1.doubleValue() +
nv2.doubleValue());
} else {
sum = Util.makeLongNode(nv1.longValue() +
nv2.longValue());
}
env.bind(args[2], sum);
return true;
}
-> So with haskell you seem to have a good way to do it.
>
> Does the above characterization have any bearing on the view
> sometimes
> expressed that properties have a somehow more fundamental role in the
> meaning of RDF? (I ask this because special properties seem
> to be the key
> mechanism whereby new "understanding" is added to CWM.)
>
===== MAGIC ==========
I built a framework that implements all properties as
Java code. This is not ideal, but works for me.
It sees a property, f.e. "vehicle:standingCapacity"
and computes the capacity for a given subject of a triple.
I need it to get foaf:FirstName out of an ActiveXObject that contains a
Person.
The activeXObject is identified with a URL and i retrieve it,
read the value through OLE and create the needed triple.
obvious this does not work, if you have a given vehicle:standingCapacity
and want
to find all subjects that fit, you need a reasoner like Haskell / CWM
there.
To sum up:
- I have used a "MAGIC" mechanism to replace properties through
functions. It is dirty.
- Jena rules are strong-typed
- combination may be wise.
greetings
Leo
Received on Saturday, 4 October 2003 06:08:25 UTC