public void resolve(
     java.lang.String identifier,
     org.dresdenocl.language.ocl.PropertyCallBaseExpCS container,
     org.eclipse.emf.ecore.EReference reference,
     int position,
     boolean resolveFuzzy,
     final org.dresdenocl.language.ocl.resource.ocl.IOclReferenceResolveResult<
             org.dresdenocl.pivotmodel.Property>
         result) {
   IOclReferenceResolveHelper rrHelper =
       OclReferenceResolveHelperProvider.getOclReferenceResolveHelper();
   if (rrHelper != null) {
     List<Property> properties = rrHelper.resolveProperty(identifier, resolveFuzzy, container);
     for (Property property : properties) {
       if (!resolveFuzzy) result.addMapping(identifier, property);
       else result.addMapping(property.getName(), property);
     }
   }
 }
  private Type findTypeOfNode(Node node) throws TypeNotFoundInModelException {

    Type result;
    result = null;

    /* Collect all parent nodes. */
    List<Node> parents;
    parents = new ArrayList<Node>();

    Node aNode;
    aNode = node;

    while (aNode != null) {

      if (aNode == aNode.getParentNode() || aNode instanceof Document) {
        break;
      } else {
        parents.add(aNode);
        aNode = aNode.getParentNode();
      }
    }
    // end while.

    if (parents.size() != 0) {

      /* Try to find the type of the root node. */
      Type rootType;
      rootType = this.findTypeOfRootNode(parents.remove(parents.size() - 1));

      if (rootType != null) {

        result = rootType;

        /* Take the next node, try to find its property and its type. */
        while (parents.size() > 0) {

          List<Property> properties;
          properties = result.allProperties();

          aNode = parents.remove(parents.size() - 1);
          result = null;

          for (Property property : properties) {
            if (property.getName().equalsIgnoreCase(aNode.getNodeName().trim())) {

              if (property.getType() instanceof CollectionType) {
                result = ((CollectionType) property.getType()).getElementType();
              } else {
                result = property.getType();
              }

              break;
            }
            // no else.
          }
          // end for.
        }
      }
      // no else (root type not found).
    }
    // no else (no parent node found).

    if (result == null) {
      throw new TypeNotFoundInModelException(
          NLS.bind(
              XmlModelInstanceTypeMessages.XmlModelInstanceFactory_UnknownTypeOfAdaptee, node));
    }
    // no else.

    return result;
  }