Hello,
I found this paper useful to have a general idea of the differences
and similarities between Frames and OWL.
http://protege.stanford.edu/conference/2006/submissions/abstracts/7.2_Wang_Hai_Protege_conf.pdf
A few more questions:
On Apr 5, 9:12 pm, lenyabl...@gmail.com wrote:
> On Apr 5, 8:24 pm, lenyabl...@gmail.com wrote:
>
> > On Apr 5, 10:53 am, lenyabl...@gmail.com wrote:> OK, you can re-use the main data binding logic (including query
> > > generation and data loading). But you would have to remove all frame
> > > API dependencies from it.Meaning that you have to replace facets and
> > > own slots(as explained above) as carriers of binding information.
> > > Basically all methods like getKey(), getGrounding() will need to be re-
> > > implemented for OWL.
> > > I can split the frame-dependant implementations and put it under
> > > public interface consisting of all the methods like getKey(),
> > > getGrounding() etc. Then you can write OWL implementation.This will
> > > require a lot of testing because splitting public API is quite
> > > intrusive change
Would it be possible to have a look to one of those methods codes to
have an idea of how they are implemented?
Cls getAbsoluteGround(Cls parent) {
if (parent == null) throw new IllegalArgumentException("null class"); if (parent.isClsMetaCls() || parent.isAbstract()) throw new IllegalArgumentException(parent.getName()+ " is abstract!");String sign = (String)parent.getOwnSlotValue(
META_SIGN); while (sign != null && !parent.isMetaCls() && !parent.isAbstract()&& parent.hasType(
META_TYPE) && !parent.hasDirectSuperclass(DATABASE)) {// exit if absolute @ground classCls cls =
KB.getCls(sign); if (cls == null || cls.isMetaCls()) break; elseparent = cls;
sign = (String)parent.getOwnSlotValue(
META_SIGN);}
return parent;}
public Cls getGroundKey(Cls parent) { return getKey(getGround(parent));}
public Cls getAbsoluteGroundKey(Cls parent) { return getKey(getAbsoluteGround(parent));}
public Cls getAbsoluteKeyGround(Cls cls) { return getGround(getAbsoluteGroundKey(cls));}
public Cls getGround(Cls cls) { if (cls == null) throw new IllegalArgumentException("null class"); if (cls.isMetaCls() || cls.isAbstract() ||cls.equals(
SUPER_RELATION) || cls.hasSuperclass(SUPER_DATABASE)) // don't use hasDirectSuperclass(DATABASE) here ! return cls;String sign = (String)cls.getOwnSlotValue(
META_SIGN); if (sign == null || sign.length()==0) throw new IllegalArgumentException(cls.getName()+" not grounded! ");Cls ground =
KB.getCls(sign); if (ground == null) throw new IllegalArgumentException(cls.getName()+" has invalid grounding: "+sign); return ground;}
public
Cls getKey(Cls cls, Slot slot) { // always use ARGS here (never SIGN !!!) if (cls == null) throw new IllegalArgumentException("null class"); if (!cls.hasTemplateSlot(slot)) throw new IllegalArgumentException(cls.getName()+ " has no slot "+slot.getName());String args = (String)cls.getTemplateFacetValue(slot,
ARGS); if (args == null || args.length()==0) { return getKey(getGround(cls));}
Cls key =
KB.getCls(args); if (key == null || !key.hasSuperclass(SUPER_KEY)) throw new IllegalArgumentException(cls.getName()+" slot "+slot.getName()+" is illegal key "+args); return key;}
public Cls getKey(Cls cls) { if (cls == null) throw new IllegalArgumentException("null class"); if (cls.isAbstract() || cls.isClsMetaCls() || !cls.hasType(META_TYPE)) throw new IllegalArgumentException(cls.getName()+ " is abstract or extraneous!");String args = (String)cls.getOwnSlotValue(
META_ARGS); if (args == null || args.length()==0) { if (cls.hasSuperclass(SUPER_DATABASE)) throw new IllegalArgumentException("Database object " + cls.getName()+ " has no key"); return getKey(getGround(cls));}
Cls key =
KB.getCls(args); //if (key == null || !key.hasSuperclass(SUPER_KEY) ) // throw new IllegalArgumentException(cls.getName()+" has illegal key: "+args); return key;}
public Cls getAbsoluteKey(Cls root) {Cls parent =
null;String args = (String) root.getOwnSlotValue(Navigator.
META_ARGS); if (args != null && args.length()>0) {parent =
KB.getCls(args); if (parent != null && parent.hasSuperclass(Navigator.SUPER_DATABASE)) {args = (String)parent.getOwnSlotValue(Navigator.
META_ARGS); if (args == null) throw new IllegalStateException("Missing key: "+parent.getName());parent =
KB.getCls(args);}
}
return parent;}
You can see that all they do is fetching facet values
It would be great if I could have access to the object that holds the
DB information between creating the Frames.
>
> > Assuming I could save the information needed to (de)serialize the
> > information to create the frames and send it to ontobase, I would be
> > able to change how the mappings are generated, right? (e.g. if
> > currently the sql queries generate a slot (or relation) and I want to
> > generate frames (or class), would this be possible by extending the
> > current API?
>
> This is a main question! I will try to give detailed and clear answer.
>
> Ontobase generates all possible logically consistent mappings from DB
> to grounding ontology (this is why initial import and analysis takes
> more time if you have more constraints).
Would it be very hard to abstract the classes that have the rules to
create these consistent mappings in order to create new
implementations for those?
Later when you guide it via
> decision tree new (=service) classes are generated to represent
> particular data flow. These are mapped by means of the same facets to
> initial (@ground) classes. Therefore there is NO DIRECT MAPPING
> =SERVICE to DB (the idea was to make services purely logical units
> independent from data serialization mechanism).
>
> So to answer your question: yes you can map =service classes to
> @ground classes any way you choose. For example you can map one-to-one
> =service to @ground - that will represent every DB relation as
> instance slot. Or you can map one =service to a join of several
> @ground classes - that will reify DB relation into a sub-class of
> DIRECTED-BINARY-RELATION with name concatenating names of joined
> tables. But doing mapping manually is a lot of work, much like
> creating logical DB model. Decision tree supposed to simplify this
> process - it is essentially a simple form of logic programming. And
> you can get reasoning support from Protege to automate mapping. Also
> Ontobase has a built-in Prolog reasoner with separate API.
I assume you use Prolog to generate the mappings. My idea is not to
generate the mappings directly, but instead I would like to implement
different set of rules to generate these mappings. For this purpose,
the class where you generate those mappings would be a kind of
"abstract class" for which inner classes that instantiate them can be
created.
Does this make sense?
It would be great if I could have access to the object that holds the
DB information between creating the Frames.Diagrams are the objects holding DB information used to create frames. All diagrams are saved and loaded every time you select corresponding frame class. You can find all of them in user.dir with *.PL extension (digrams are implemented with Prolog dialect)
>
> > Assuming I could save the information needed to (de)serialize the
> > information to create the frames and send it to ontobase, I would be
> > able to change how the mappings are generated, right? (e.g. if
> > currently the sql queries generate a slot (or relation) and I want to
> > generate frames (or class), would this be possible by extending the
> > current API?
>
> This is a main question! I will try to give detailed and clear answer.
>
> Ontobase generates all possible logically consistent mappings from DB
> to grounding ontology (this is why initial import and analysis takes
> more time if you have more constraints).
Would it be very hard to abstract the classes that have the rules to
create these consistent mappings in order to create new
implementations for those?Abstracting is not a problem, but rules are coded in the implementation. So there is no explicit declaration of rules. It was planning to implement all rules as Prolog theories, but ended up doing it in Java. If you are comfortable with Prolog , then it should not be difficult to do it since diagrams extracted from DB in that format. Another option to use JDBC directly and bypass diagrams alltogether.
Hello,
Yes, you can open each file directly from ontobase plug-in (buttons at top right) and dre_n odes are used as interim representation of DB schema used to generate frames.
>
> > Assuming I could save the information needed to (de)serialize the
> > information to create the frames and send it to ontobase, I would be
> > able to change how the mappings are generated, right? (e.g. if
> > currently the sql queries generate a slot (or relation) and I want to
> > generate frames (or class), would this be possible by extending the
> > current API?
>
> This is a main question! I will try to give detailed and clear answer.
>
> Ontobase generates all possible logically consistent mappings from DB
> to grounding ontology (this is why initial import and analysis takes
> more time if you have more constraints).
Would it be very hard to abstract the classes that have the rules to
create these consistent mappings in order to create new
implementations for those?Abstracting is not a problem, but rules are coded in the implementation. So there is no explicit declaration of rules. It was planning to implement all rules as Prolog theories, but ended up doing it in Java. If you are comfortable with Prolog , then it should not be difficult to do it since diagrams extracted from DB in that format. Another option to use JDBC directly and bypass diagrams alltogether.
My idea so far was to represent these mappings as SWRL (horn-like) rules which is more standard. It would be very similar to the prolog theories you talk about.
Thank you for the information, those are my questions so far. it is now more clear to me the work involved to extend Ontobase for this particular goal.