Examples of LabeledLink


Examples of de.jetwick.ui.util.LabeledLink

                if (str.length() > 20)
                    str = str.substring(0, 20) + "..";
                return "Find origin of '" + str + "'";
            }
        };
        findOriginLink = new LabeledLink("findOriginLink", null, qModel, false) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                PageParameters pp = new PageParameters();
                pp.add("findOrigin", query);
                setResponsePage(TweetSearchPage.class, pp);
            }
        };

        add(findOriginLink);
        translateAllLink = new LabeledLink("translateAllLink", null, new Model<String>() {

            @Override
            public String getObject() {
                if (translateAll)
                    return "Show original language";
                else
                    // get english name of iso language chars
                    return "Translate tweets into " + new Locale(toLanguage).getDisplayLanguage(new Locale("en"));
            }
        }) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target == null)
                    return;

                translateAll = !translateAll;
                if (!translateAll)
                    translateMap.clear();
                target.addComponent(ResultsPanel.this);
            }
        };

        add(translateAllLink);
        add(createSortLink("sortRelevance", ElasticTweetSearch.RELEVANCE, "desc"));
        add(createSortLink("sortRetweets", ElasticTweetSearch.RT_COUNT, "desc"));
        add(createSortLink("sortLatest", ElasticTweetSearch.DATE, "desc"));
        add(createSortLink("sortOldest", ElasticTweetSearch.DATE, "asc"));       
           
        add(new DialogUtilsBehavior());

        userView = new ListView("users", users) {

            @Override
            public void populateItem(final ListItem item) {
                final JUser user = (JUser) item.getModelObject();
                String name = user.getScreenName();
                if (user.getRealName() != null)
                    name = user.getRealName() + "  (" + name + ")";

                LabeledLink userNameLink = new LabeledLink("userNameLink", name, false) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        onUserClick(user.getScreenName(), null);
                    }
View Full Code Here

Examples of de.jetwick.ui.util.LabeledLink

                final Entry<String, List<FacetHelper>> entry = (Entry<String, List<FacetHelper>>) item.getModelObject();

                String dtVal = translate(entry.getKey());
                String filter = getFilterName(entry.getKey());
                if (filter != null) {
                    item.add(new LabeledLink("filterName", "< " + dtVal) {

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            onRemoveAllFilter(target, entry.getKey());
                        }
View Full Code Here

Examples of de.jetwick.ui.util.LabeledLink

            return this;
        }
        final JUser user = tweet.getFromUser();

        if (showUser) {
            LabeledLink userNameLink = new LabeledLink("userNameLink", user.getScreenName() + ":", false) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    onUserClick(user.getScreenName());
                }
View Full Code Here

Examples of de.jetwick.ui.util.LabeledLink

            @Override
            public void populateItem(final ListItem item) {
                boolean filteredUrl = (Boolean) item.getModelObject();
                if (filteredUrl) {
                    item.add(new LabeledLink("filterName", "< " + TITLE) {

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            onUrlClick(target, null);
                        }
View Full Code Here

Examples of de.jetwick.ui.util.LabeledLink

            @Override
            public void populateItem(final ListItem item) {
                String filter = getFilterName(dtKey);
                if (filter != null) {
                    item.add(new LabeledLink("dateFilter", "Click to remove custom date filter") {

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            onFilterChange(target, dtKey, null);
                        }
View Full Code Here

Examples of edu.isi.karma.rep.alignment.LabeledLink

   
    /*** Add the appropriate nodes and links in alignment graph ***/
    List<SemanticType> typesList = new ArrayList<SemanticType>();
    for (int i = 0; i < typesArr.length(); i++) {
      try {
        LabeledLink newLink = null;
        JSONObject type = typesArr.getJSONObject(i);
       
        String domainValue;
        // For property semantic types, domain uri goes to "domainValue" and link uri goes to "fullTypeValue".
        // For class semantic type, class uri goes "fullTypeValue" and "domainValue" is empty.
        if(type.has(ClientJsonKeys.DomainId.name()))
          domainValue = type.getString(ClientJsonKeys.DomainId.name());
        else
          domainValue = type.getString("Domain"); //For backward compatibility to older models
        String fullTypeValue = type.getString(ClientJsonKeys.FullType.name());
//        logger.trace("FULL TYPE:" + type.getString(ClientJsonKeys.FullType.name()));
//        logger.trace("Domain: " + type.getString(ClientJsonKeys.Domain.name()));
       
        // Look if the domain value exists. If it exists, then it is a domain of a data property. If not
        // then the value in FullType has the the value which indicates if a new class instance is needed
        // or an existing class instance should be used (this is the case when just the class is chosen as a sem type).
//        Label domainName = null;
       
        boolean isClassSemanticType = false;
        boolean semanticTypeAlreadyExists = false;
        Node domain = null;
        String domainUriOrId;
        Label linkLabel;
       
        // if domain value is empty, semantic type is a class semantic type
        if (domainValue.equals("")) {
          isClassSemanticType = true;
          domainUriOrId = fullTypeValue;
          linkLabel = ClassInstanceLink.getFixedLabel();
        } else {
          isClassSemanticType = false;
          domainUriOrId = domainValue;
          linkLabel = ontMgr.getUriLabel(fullTypeValue);
          if (linkLabel == null) {
            logger.error("URI/ID does not exist in the ontology or model: " + fullTypeValue);
            continue;
          }
        }
       
        if(domainUriOrId.endsWith(" (add)"))
          domainUriOrId = domainUriOrId.substring(0, domainUriOrId.length()-5).trim();
       
        domain = alignment.getNodeById(domainUriOrId);
        logger.info("Got domain for domainUriOrId:" + domainUriOrId + " ::" + domain);
        if (domain == null) {
          Label label = ontMgr.getUriLabel(domainUriOrId);
//          if (label == null) {
//            logger.error("URI/ID does not exist in the ontology or model: " + domainUriOrId);
//            continue;
//          }
          if (label == null) {
            if(type.has(ClientJsonKeys.DomainUri.name())) {
              label = new Label(type.getString(ClientJsonKeys.DomainUri.name()));
            } else {
              //This part of the code is for backward compatibility. Newer models should have domainUri
              int len = domainValue.length();
              if ((len > 1) && Character.isDigit(domainValue.charAt(len-1))) {
                String newDomainValue = domainValue.substring(0, len-1);
                label = ontMgr.getUriLabel(newDomainValue);
              }
              if (label == null) {
                logger.error("No graph node found for the node: " + domainValue);
                return new UpdateContainer(new ErrorUpdate("" +
                "Error occured while setting semantic type!"));
              }
            }
          }
          domain = alignment.addInternalNode(label);
        }
         
        // Check if a semantic type already exists for the column
        ColumnNode columnNode = alignment.getColumnNodeByHNodeId(hNodeId);
        columnNode.setRdfLiteralType(rdfLiteralType);
        List<LabeledLink> columnNodeIncomingLinks = alignment.getIncomingLinks(columnNode.getId());
        LabeledLink oldIncomingLinkToColumnNode = null;
        Node oldDomainNode = null;
        if (columnNodeIncomingLinks != null && !columnNodeIncomingLinks.isEmpty()) { // SemanticType already assigned
          semanticTypeAlreadyExists = true;
          oldIncomingLinkToColumnNode = columnNodeIncomingLinks.get(0);
          oldDomainNode = oldIncomingLinkToColumnNode.getSource();
        }

        if (type.getBoolean(ClientJsonKeys.isPrimary.name())) {
         
          if (isClassSemanticType) {
            if (semanticTypeAlreadyExists && oldDomainNode == domain) {
              newLink = oldIncomingLinkToColumnNode;
              // do nothing;
            } else if (semanticTypeAlreadyExists) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
//              alignment.removeNode(oldDomainNode.getId());
              newLink = alignment.addClassInstanceLink(domain, columnNode, LinkKeyInfo.None);
            } else {
              newLink = alignment.addClassInstanceLink(domain, columnNode, LinkKeyInfo.None);
            }
          }
          // Property semantic type
          else {

            // When only the link changes between the class node and the internal node (domain)
            if (semanticTypeAlreadyExists && oldDomainNode == domain) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            }
            // When there was an existing semantic type and the new domain is a new node in the graph and semantic type already existed
            else if (semanticTypeAlreadyExists) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
//              alignment.removeNode(oldDomainNode.getId());
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            } else {
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            }           
View Full Code Here

Examples of edu.isi.karma.rep.alignment.LabeledLink

        continue;
     
      id = LinkIdFactory.getLinkId(uri, sourceId, targetId);
      label = new Label(ontologyManager.getUriLabel(uri));
     
      LabeledLink newLink;
      if (uri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI))
        newLink = new SubClassLink(id);
      else
        newLink = new ObjectPropertyLink(id, label, linkObjectPropertyType);
     
View Full Code Here

Examples of edu.isi.karma.rep.alignment.LabeledLink

   
    for (Node n : model.getGraph().vertexSet()) {
      Set<Node> matches = new HashSet<Node>();
      if (n instanceof ColumnNode) {
        Node domain = modelNodeDomains.get(n);
        LabeledLink incomingLink = nodeToDataProperty.get(n);
        Set<Node> matchedNodes = this.graphBuilder.getUriToNodesMap().get(domain.getUri());
        if (matchedNodes == null || matchedNodes.isEmpty()) {
          logger.error("no match found for the node " + domain.getUri() + "in the graph");
          return null;
        }
        for (Node m : matchedNodes) {
          String graphKey = m.getId() + incomingLink.getUri();
          Set<Node> dataPropertyColumnNodes = this.graphBuilder.getNodeDataProperties().get(graphKey);
          Integer graphDataPropertyCount = this.graphBuilder.getNodeDataPropertyCount().get(graphKey);
          if (graphDataPropertyCount == null) graphDataPropertyCount = 0;
          if (dataPropertyColumnNodes != null) {
            for (Node cn : dataPropertyColumnNodes) {
              matches.add(cn);
            }
          }
          String modelKey = domain.getId() + incomingLink.getUri();
          int modelDataPropertyCount = dataPropertyCount.get(modelKey);
          for (int i = 0; i < modelDataPropertyCount - graphDataPropertyCount; i++) {
            Node newNode = null;
            if (n instanceof ColumnNode) {
              ColumnNode c = (ColumnNode)n;
              newNode = new ColumnNode(new RandomGUID().toString(), c.getHNodeId(), c.getColumnName(), c.getRdfLiteralType());
            }
            if (newNode == null) {
              return null;
            }
            if (this.graphBuilder.addNode(newNode)) {
              matches.add(newNode);
              String linkId = LinkIdFactory.getLinkId(incomingLink.getUri(), m.getId(), newNode.getId());
              DataPropertyLink link = new DataPropertyLink(linkId, new Label(incomingLink.getLabel()));
              this.graphBuilder.addLink(m, newNode, link);
            }
          }
          columnNodeMatches.put(n, matches);
        }
View Full Code Here

Examples of edu.isi.karma.rep.alignment.LabeledLink

        if (n2 == null) {
//          logger.warn("the mappings does not include the target node " + target.getId());
          continue;
        }
        String id = LinkIdFactory.getLinkId(e.getUri(), n1.getId(), n2.getId());
        LabeledLink l = this.graphBuilder.getIdToLinkMap().get(id);
        if (l != null) {
          int numOfPatterns = l.getModelIds().size();
//          this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT);
//          this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT / (double) (numOfPatterns + 1) );
          if (n2 instanceof InternalNode)
            this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT - (0.00001 * numOfPatterns) );
          else
            this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT);
          l.getModelIds().add(indexedModelId);
          n1.getModelIds().add(indexedModelId);
          n2.getModelIds().add(indexedModelId);
        } else {
//          System.out.println("added links: " + i);
//          i++;
          LabeledLink link;
          if (e instanceof DataPropertyLink)
            link = new DataPropertyLink(id, e.getLabel());
          else if (e instanceof ObjectPropertyLink)
            link = new ObjectPropertyLink(id, e.getLabel(), ((ObjectPropertyLink)e).getObjectPropertyType());
          else if (e instanceof SubClassLink)
            link = new SubClassLink(id);
          else if (e instanceof ClassInstanceLink)
            link = new ClassInstanceLink(id, e.getKeyType());
          else if (e instanceof ColumnSubClassLink)
            link = new ColumnSubClassLink(id);
          else if (e instanceof DataPropertyOfColumnLink)
            link = new DataPropertyOfColumnLink(id,
                ((DataPropertyOfColumnLink)e).getSpecializedColumnHNodeId(),
                ((DataPropertyOfColumnLink)e).getSpecializedLinkId()
                );
          else if (e instanceof ObjectPropertySpecializationLink)
            link = new ObjectPropertySpecializationLink(id, ((ObjectPropertySpecializationLink)e).getSpecializedLinkId());
          else {
              logger.error("cannot instanciate a link from the type: " + e.getType().toString());
              continue;
          }
          link.getModelIds().add(indexedModelId);
          if (!this.graphBuilder.addLink(n1, n2, link, ModelingParams.PATTERN_LINK_WEIGHT)) continue;

          n1.getModelIds().add(indexedModelId);
          n2.getModelIds().add(indexedModelId);
         
View Full Code Here

Examples of edu.isi.karma.rep.alignment.LabeledLink

        ColumnNode target = new ColumnNode(nodeId, nodeId, sourceColumn.getColumnName(), null);
        if (!this.graphBuilder.addNode(target)) continue;;
        addedNodes.add(target);

        String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId())
        LabeledLink link = new DataPropertyLink(linkId, new Label(propertyUri));
       
        boolean result = weight == null ? this.graphBuilder.addLink(source, target, link) : this.graphBuilder.addLink(source, target, link, weight);
        if (!result) continue;;

        SemanticTypeMapping mp = new SemanticTypeMapping(sourceColumn, semanticType, (InternalNode)source, link, target);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.