Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-402

XML Graph Importer should support importing multi-valued properties

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 0.4
    • None
    • API, Graph (2.x)
    • None

      The XML handler used in the Graph importer (that is, org.jboss.dna.graph.xml.XmlHandler) does not currently support producing multi-valued properties. This is a fairly substantial limitation.

      The current XML handler simply maps an XML element to a graph node and an XML attribute to a property. There is no such thing as multi-valued XML attributes, so another mapping has to be used for multi-valued properties. Since a graph node does not directly hold any values (rather, it holds properties that have the values), and the XML handler currently ignores all XML character content (e.g., <element>this is character content</element>), it is fairly logical to conclude that a child XML element with character content should be mapped to a property. If there is a "jcr:name" attribute, then this attribute's value would be used to determine the property name (meaning the element's name could be anything); otherwise, the child element's name would be the property name.

      This would also address the shortcoming of XML attribute values not being able to (easily) have any character content, since such property values could be placed in a child element.

      Here's an example:

      <cars>
      <car jcr:name="Mini">
      <jcr:description>This is a description that would be stored as a property on the 'Mini' node</jcr:description>
      <property jcr:name="summary">This is the value of the 'summary' property on the 'Mini' node</property>
      </car>
      </cars>

      I'm not sure how easy it is to change the XmlHandler to behave this way, since under certain situations it may require postponing the creation of a node since it is unknown when processing a "startElement" method that the element has character content. However, I believe that it is worth any additional complexity to make the XML more intuitive and natural.

        1. DNA-378.patch
          22 kB
        2. DNA-378_round_3.patch
          34 kB
        3. DNA-378_redux.patch
          29 kB

              rhauch Randall Hauch (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: