Since there are only a few of us on the #higgins chat channel, I'll copy this here (sorry about the length):
(11:16:22) Jimse: From Paul's sample RDF, I don't think DOMDocument or DOMNode is a natural fit for attribute values. (11:17:40) domanator: why not? DOMDocument implements both W3C and DOM4j interfaces. (11:17:42) Jimse: I mean in that example, one would get a node called jim:hasPostalAddress. Then you'd have to get the rdfDescription, look at the rdf:about attribute, and then *somehow* dereference its value (11:18:02) Jimse: how would you even do that? (11:18:28) domanator: Oh, using DOM. hmmmm. (11:19:15) Jimse: You'd have to be able to back up to the document level (get to the rdf:RDF node, then find the jims-address node (11:19:30) Jimse: seems clunky (11:19:39) Jimse: if it's even possible (11:20:02) Jimse: OTOH, I'm not sure there's a library in existence that would allow it. (11:20:06) domanator: no, i've done stuff like that in our config file parsing. (11:20:16) domanator: using xpath (11:20:33) domanator: you find the pointer you want, then build xpath based on that. (11:20:36) Jimse: given a node, you are able to back up it's parent chain and come back down into a different node? (11:21:06) Jimse: remember that this attribute value (hasPostalAddress) would just be a node (11:21:07) domanator: yeah (11:21:17) Jimse: there's not even a guarantee that it would have a parent (11:21:43) domanator: hasPostalAddress may not have a parent? (11:22:17) domanator: i thought "has" had to be part of another record, the thing it points to may have no parent (11:23:13) Jimse: maybe it would work this way: the attribute's name is the "jim:hasPostalAddress". The attribute value is the <rdf:Description rdf:about="urn:jims-address"> node (11:25:53) Jimse: once one has that node, they know (via schema) that there will be child nodes called "jim:city", "jim:postalCode", etc. (11:27:18) domanator: hmmm, true. you're right though, s'a bit weird to try to represent in an attribute value as DOM. couldn't tell where you were going at first. (11:30:00) Jimse: Node lets me get its value as text, but not as any other type (11:30:42) Jimse: so if the model said some attribute is of type xsd:int, we could only get the string value of that and convert it to a real integer (11:31:12) Jimse: this is one of the reasons why we made up our own DOM-like library in that previous project we were working on. (11:32:44) domanator: ah yes, indeed ... that previous project (11:33:21) Jimse: The fact that a DigitalSubject's attribute might be either a DatatypeProperty, or an ObjectProperty causes some issues in determining the type of class(es) to use for the value. (11:34:00) Jimse: for example, there's no reason to use Node for the simple attributes in the sample (surname, firstname) (11:34:50) Jimse: in the sample, all DataTypeProperties are simple types. (11:34:51) domanator: simple == string (11:35:01) Jimse: This is one of the things I need clarification on. (11:35:21) Jimse: it may be possible that a DatatypeProperty could be a complex XML (11:36:02) Jimse: due to lack of Paul -- I better read more... (11:37:14) Jimse: We may end up changing the interfaces such that IAttribute is not a name/object pair. It may itself end up being Node. (11:37:25) Jimse: (or some equiv.) (11:37:51) domanator: that'd work ok, cuz each Node could, in turn be a simple type. (11:39:18) Jimse: we'd have to fudge some things to make it more natural though. Like in the case of an ObjectProperty. (11:39:48) Jimse: You don't want a node back that looks like: (11:39:48) Jimse: <jim:hasPostalAddress> (11:39:48) Jimse: <rdf:Description rdf:about="urn:jims-address"/> (11:39:48) Jimse: </jim:hasPostalAddress> (11:40:28) Jimse: you want this back: (11:40:28) Jimse: <jim:hasPostalAddress> (11:40:28) Jimse: <jim:city>Provo</jim:city> (11:40:28) Jimse: <jim:postalCode>84605</jim:postalCode> (11:40:28) Jimse: <jim:state>Utah</jim:state> (11:40:28) Jimse: <jim:streetAddress>123 main street</jim:streetAddress> (11:40:28) Jimse: </jim:hasPostalAddress> (11:40:40) Jimse: or similar (11:41:15) domanator: right, something like that (11:41:54) Jimse: also need to look at the eodm libraries (11:42:27) domanator: eodm? (11:43:57) Jimse: "EODM is the run-time library that allows the application to read and serialize an RDFS/OWL ontology in RDF/XML format; manipulate an ontology using Java objects; call an inference engine and access inference results; and transform between ontology and other models." |