--Athant 14:58, 6 July 2012 (UTC)
Some preliminary discussion is available (only) to RuleML Wiki users at Priv:FY2012-13WP0#RuleML_Formal_Metamodel_and_Ontology.
2 Lessons Learned from Metamodel Development in LegalRuleML
- An XSLT transformation can be written that can be applied to a (mostly) general striped xml instance, turning it into RDF/XML. However, there were a number of cases that had to be handled specially including:
- key/keyref makes things complicated, but it has been resolved by reifying the resolved construct and relating it to a two member collection consisting of the explicit definition and the keyreffed definition.
- attributes whose values are not IRIs have to be converted to child elements
- a function is needed to map the XML instance namespaces into the appropriate metamodel namespace
- the lower-case and upper-case naming convention followed by RuleML (and LegalRuleML) was exploited to distinguish between edge and Node elements. However <ruleml:slot> defies this classification - in some cases it would be desirable to translate a slot directly into a triple, in other cases the triple needs to be reified.
- The RDF Collection (rdf:List) was used for the ordered sequences contained in e.g. Atom, Expr, Plex, And, Or (in contrast to rdf:Bag and rdf:Seq used in http://ruleml.org/inrdf.html). This was done because the collection may be closed if a little extra expressivity is allowed for the metamodel (e.g. OWL). On the downside, if the corresponding edges are labelled (i.e. with xml:id) then this representation is very verbose. However, it can be considerably compressed when labels are absent using the rdf:parseType of Collection (not implemented in the LegalRuleML XSLT for parsing to RDF).
- Functionality axioms can be used to close the syntax in the case of children that are required to be present once (e.g. <ruleml:op>). Note that in the case of distributed syntax (key/keyref) the property can still be considered functional but unknown.
- Interpreting absence of an optional child or attribute as cardinality zero may be appropriate in some cases, e.g. @closure, <degree>. Expressing this explicitly in RDF would require a pull-style template and OWL/RDF syntax. Alternately, the RDF graph may be treated with a closed-world assumption.
- Elements with XML Literal content need to be identified.
- xsi:type can be translated to rdf:datatype if the value is a simple xsd type, but this won't work with complex types.
- xml:id on edge elements was interpreted as the label for the reified triple. A clear interpretation for xml:id on Node elements is not so straight-forward, so it was simply translated into a child element.
The formal specification of the RuleML metamodel in RDFS is being developed on Github at https://github.com/RuleML/ruleml-metamodel .
Contributors are welcome to fork the repository and submit pull requests.
Please validate your changes against the schema http://www.w3.org/TR/2003/WD-rdf-syntax-grammar-20030123/rdfxml.rng, using for example http://Validator.nu or oXygen.