Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: javadoc/api
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      358

      Description

      All getSelectorName() methods are specified to return non-null names. At the
      same time the QueryObjectModelFactory has methods that create JQOM nodes without
      a selector. Should getSelectorName() return null in that case or some kind of
      default value?

      Another related question: is the selector name automatically set to the node
      type name for the following method?

      public Selector selector(String nodeTypeName)

      or will the selector return null when getSelectorName() is called?

        Issue Links

          Activity

          Hide
          dpitfiel added a comment -

          All selectors have (non-null) names. If a query has only one selector, we call
          that selector the "default selector". If a query has more than one selector,
          there is no default selector.

          In the case where there is a default selector, a factory method that omits the
          selectorName parameter is exactly equivalent to passing the default selector
          name to the overload of that factory method with a selectorName parameter. This
          equivalence should be explicitly called out in the Javadoc.

          Therefore, getSelectorName() should return the selector's (non-null) name.

          > public Selector selector(String nodeTypeName)

          The Javadoc states "The selector name is the node type name." This needs to be
          reflected in the method description in the body of the specification.

          Show
          dpitfiel added a comment - All selectors have (non-null) names. If a query has only one selector, we call that selector the "default selector". If a query has more than one selector, there is no default selector. In the case where there is a default selector, a factory method that omits the selectorName parameter is exactly equivalent to passing the default selector name to the overload of that factory method with a selectorName parameter. This equivalence should be explicitly called out in the Javadoc. Therefore, getSelectorName() should return the selector's (non-null) name. > public Selector selector(String nodeTypeName) The Javadoc states "The selector name is the node type name." This needs to be reflected in the method description in the body of the specification.
          Hide
          mreutegg added a comment -

          > In the case where there is a default selector, a factory method that omits
          > the selectorName parameter is exactly equivalent to passing the default
          > selector name to the overload of that factory method with a selectorName
          > parameter. This equivalence should be explicitly called out in the Javadoc.

          I'm probably missing something, but how can those be equivalent, when one
          factory method omits the selectorName?

          Example:

          QueryObjectModelFactory qomFactory = ...
          PropertyExistence myProp = qomFactory.propertyExistence("my:property");
          String selectorName = myProp.getSelectorName();
          // what value does selectorName have?

          > The Javadoc states "The selector name is the node type name." This needs
          > to be reflected in the method description in the body of the specification.

          Thanks for the pointer. I was looking at the specification and didn't see it
          is mentioned in the JavaDoc.

          Show
          mreutegg added a comment - > In the case where there is a default selector, a factory method that omits > the selectorName parameter is exactly equivalent to passing the default > selector name to the overload of that factory method with a selectorName > parameter. This equivalence should be explicitly called out in the Javadoc. I'm probably missing something, but how can those be equivalent, when one factory method omits the selectorName? Example: QueryObjectModelFactory qomFactory = ... PropertyExistence myProp = qomFactory.propertyExistence("my:property"); String selectorName = myProp.getSelectorName(); // what value does selectorName have? > The Javadoc states "The selector name is the node type name." This needs > to be reflected in the method description in the body of the specification. Thanks for the pointer. I was looking at the specification and didn't see it is mentioned in the JavaDoc.
          Hide
          dpitfiel added a comment -

          You are quite correct. This is the same point you raised in the other issue:
          since the objects in a QueryObjectModel tree are constructed "bottom-up", they
          can't have knowledge of ancestors (or siblings) in the tree until those
          ancestors are created.

          However, just to be clear, a couple of points still hold:

          • All Selectors have a (non-null) name.
          • For query evaluation, in the case where there is a default selector, an
            object constructed by a factory method that omits the selectorName parameter is
            exactly equivalent to an object constructed by passing the default selector name
            to the overload of that factory method with a selectorName parameter. This
            equivalence should be explicitly called out in the Javadoc.

          But, the question remains what getSelectorName() should return on objects
          constructed by the "implied default selector" factory methods. I guess it
          should return null. The Javadoc should be corrected.

          Show
          dpitfiel added a comment - You are quite correct. This is the same point you raised in the other issue: since the objects in a QueryObjectModel tree are constructed "bottom-up", they can't have knowledge of ancestors (or siblings) in the tree until those ancestors are created. However, just to be clear, a couple of points still hold: All Selectors have a (non-null) name. For query evaluation , in the case where there is a default selector, an object constructed by a factory method that omits the selectorName parameter is exactly equivalent to an object constructed by passing the default selector name to the overload of that factory method with a selectorName parameter. This equivalence should be explicitly called out in the Javadoc. But, the question remains what getSelectorName() should return on objects constructed by the "implied default selector" factory methods. I guess it should return null. The Javadoc should be corrected.
          Hide
          mreutegg added a comment -

          I agree with all your points, specifically with the query evaluation semantics.

          My concern was wrt the JQOM representation of a query.

          I think returning null for a JQOM node that implies the default selector is the
          only reasonable solution.

          Show
          mreutegg added a comment - I agree with all your points, specifically with the query evaluation semantics. My concern was wrt the JQOM representation of a query. I think returning null for a JQOM node that implies the default selector is the only reasonable solution.
          Hide
          dpitfiel added a comment -

          How about removing the idea of a "default selector" altogether? Then every
          selector will have an (explicitly assigned) name. At that point, we can also
          remove the "default selector" convenience methods, for example, column(String)
          versus column(String, String); these are flagged with "// CM" in the Java source
          for QueryObjectModelFactory. This gives us a more concise API (fewer pages...)
          and clarifies the original question raised by this issue.

          Show
          dpitfiel added a comment - How about removing the idea of a "default selector" altogether? Then every selector will have an (explicitly assigned) name. At that point, we can also remove the "default selector" convenience methods, for example, column(String) versus column(String, String); these are flagged with "// CM" in the Java source for QueryObjectModelFactory. This gives us a more concise API (fewer pages...) and clarifies the original question raised by this issue.
          Hide
          stefan_guggisberg added a comment -

          resolved as fixed as per F2F decision in Basel, Sept 07:

          consensus, fix as proposed

          Show
          stefan_guggisberg added a comment - resolved as fixed as per F2F decision in Basel, Sept 07: consensus, fix as proposed
          Hide
          Peeter Piegaze added a comment -

          consensus reached but not yet fixed in spec

          Show
          Peeter Piegaze added a comment - consensus reached but not yet fixed in spec
          Hide
          Peeter Piegaze added a comment -

          Removed default selector related methods in src. Added language in spec explaining that SQL2
          statements without an explicit selector have one assigned by the impl, and that selector name is visible in
          the JQOM tree if you look.

          Show
          Peeter Piegaze added a comment - Removed default selector related methods in src. Added language in spec explaining that SQL2 statements without an explicit selector have one assigned by the impl, and that selector name is visible in the JQOM tree if you look.

            People

            • Assignee:
              jsr-283-issues
              Reporter:
              mreutegg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: