Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2590

ClassCastException when specifying "single cardinality" for edge property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 3.4.8
    • None
    • structure
    • None

    Description

      As I understand it, multi-properties are not supported on edges in Tinkerpop, and this is an understandable limitation. However, my expectation as an API client is that if I redundantly specify Cardinality.single when setting a property on an edge, it would succeed silently. Instead AddPropertyStep.java:151,153 (as of 3.4.8) unconditionally casts the traversal element to Vertex on seeing any Cardinality at all, producing a confusing ClassCastException.

      (1) In the case of single, which specifies the correct semantics, the call should succeed. (This is relevant when trying to reuse a method to update a single-valued timestamp on a generic Element.)

      (2) It would be a major improvement to debugging to, instead of performing inline casting, use a wrapper method producing an error message such as "property cardinality may only be specified for a Vertex".

      There are many cases throughout the code where (2) applies; would you be interested in contributions to retrofit enhanced error messages?

      Attachments

        Activity

          People

            Unassigned Unassigned
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: