Examples of Lens


Examples of edu.mit.simile.fresnel.selection.Lens

    LensMatchSet match = null;

    Iterator<Lens> li = grouping.getLenses().iterator();
    while (li.hasNext()) {
      Lens lens = li.next();
      Iterator<ISelector> di = lens.getDomainSet().iterator();
      while (di.hasNext()) {
        ISelector select = di.next();
        if (select.canSelectResources()) {
          if (select.canSelect(in, focus)) {
            if (null == validStarts || (null != validStarts && validStarts.contains(focus))) {
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

      throw new NoResultsException("No lenses matching the data could be found.");

    Selection answer = new Selection(this);
    answer.setLangPref(langPref);

    Lens best = match.topMatch();

    // check purposes
    for (Iterator<Lens> pli = match.lensIterator(); pli.hasNext(); ) {
      Lens potential = pli.next();
      if (potential.hasPurpose(purpose)) {
        best = potential;
        break;
      }
    }
    answer.addPrimary(answer.applyLens(grouping, in, best, focus, 0, MAXIMUM_LENS_DEPTH));
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

      throw new NoResultsException("No lenses matching the data could be found.");

    Selection answer = new Selection(this);
    answer.setLangPref(langPref);
   
    Lens best = match.topMatch();
    answer.addPrimary(answer.applyLens(grouping, in, best, focus, 0, MAXIMUM_LENS_DEPTH));

    return answer;
  }
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

   * @return The found <code>Lens</code>
   * @throws ParsingException If the lens is not found anywhere or if there are problems parsing the lens
   * @throws UnresolvableException If there are problems parsing the lens
   */
  public Lens lensLookup(Resource identifier) throws ParsingException, UnresolvableException, ResourceNotFoundException {
    Lens out = null;
    if (this._all.containsKey(identifier) && this._lenses.contains(this._all.get(identifier)))
      out = (Lens) this._all.get(identifier);
    else {
      RepositoryConnection conn = null;
      try {
        conn = this._source.getConnection();
        if (conn.hasStatement(identifier, FresnelCore.instanceLensDomain, (Value) null, false)) {
          out = new InstanceLens(this._source, identifier, this);
          addInstanceLens(out);
        } else if (conn.hasStatement(identifier, FresnelCore.classLensDomain, (Value) null, false)) {
          out = new Lens(this._source, identifier, this);
          addLens(out);
        } else {
          throw new ResourceNotFoundException("Explicitly named lens not found in configuration");
        }
      } catch (RepositoryException e) {
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

          } else {
            // instance
            int i = 0;
            int size = this._instances.size();
            for ( ; i < size; i++) {
              Lens compare = this._instances.get(i);
              if (((URI) compare.getIdentifier()).toString().compareTo(((URI) lens.getIdentifier()).toString()) < 0) {
                this._instances.add(i, lens);
                break;
              }
            }
            if (size == i) this._instances.add(lens);
          }
        } else if (lens.isDefault()) {
            // default
            int i = 0;
            int size = this._defaults.size();
            for ( ; i < size; i++) {
                Lens compare = (Lens) this._defaults.get(i);
                if (((URI) compare.getIdentifier()).toString().compareTo(((URI) lens.getIdentifier()).toString()) < 0) {
                    this._defaults.add(i, lens);
                    break;
                }
            }
            if (size == i) this._defaults.add(lens);
        } else {
            // class
            int i = 0;
            int size = this._types.size();
            for ( ; i < size; i++) {
                Lens compare = (Lens) this._types.get(i);
                if (((URI) compare.getIdentifier()).toString().compareTo(((URI) lens.getIdentifier()).toString()) < 0) {
                    this._types.add(i, lens);
                    break;
                }
            }
            if (size == i) this._types.add(lens);
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

     * Returns the top ranked match for the resource amongst all applicable lenses
     *
     * @return A matching <code>Lens</code>
     */
    public Lens topMatch() {
        Lens out = null;
        if (this._instances.size() > 0) out = (Lens) this._instances.get(0);
        else if (this._defaults.size() > 0) out = (Lens) this._defaults.get(0);
        else if (this._types.size() > 0) out = (Lens) this._types.get(0);
        return out;
    }
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

                  // if we've hit the limit, stop with sublensing
                  subr.setTitle(resolveLabel(in, objResource));
                } else {                 
                  // pick a sublens to apply to the resource
                  int newdepth = (selectorPD.getDepth() + current < max) ? selectorPD.getDepth() + current : max;
                  Lens sublens = null;
                  Iterator<Lens> sublensesIt = selectorPD.getSublensesIterator();
                  boolean match = false;
                  matched:
                  while (sublensesIt.hasNext()) {
                    sublens = sublensesIt.next();
                    Iterator<ISelector> domainIt = sublens.getDomainSet().iterator();
                    while (domainIt.hasNext()) {
                      ISelector subdomain = domainIt.next();
                      if (subdomain.canSelect(in, objResource)) {
                        subr = applyLens(group, in, sublens, objResource, current + 1, newdepth);
                        match = true;
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

                  pr.addValue(vr);
                  this._propertyResultModelHash.putResult(prop, pr);
                } else {
                  // pick a sublens to apply to the resource
                  int newdepth = (selectorPD.getDepth() + current < max) ? selectorPD.getDepth() : max;
                  Lens sublens = null;
                  Iterator<Lens> sublensesIt = selectorPD.getSublensesIterator();
                  boolean matched = false;
                  matching:
                  while (sublensesIt.hasNext()) {
                    sublens = sublensesIt.next();
                    Iterator<ISelector> domainIt = sublens.getDomainSet().iterator();
                    while (domainIt.hasNext()) {
                      ISelector subdomain = domainIt.next();
                      if (subdomain.canSelect(in, objResource)) {
                        Result subr = applyLabelLens(sublens, in, objResource, current + 1, newdepth);
                        ValueResult vr = new ValueResult(subr, pr, selected.getContext());
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

    if (lens) {
      if (null != lenses) {
        // find label lens for resource
        Iterator<Lens> instancesIt = lenses.getInstanceLenses().iterator();
        while (instancesIt.hasNext()) {
          Lens check = instancesIt.next();
          if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) { 
            AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
            if (labels.getString().trim().equals(""))
              continue;
            else
              return new Title(labels);
          }
        }
       
        // find label lens for resource's type
        Iterator<Lens> classesIt = lenses.getClassLenses().iterator();
        while (classesIt.hasNext()) {
          Lens check = classesIt.next();
          if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
            AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
            if (labels.getString().trim().equals(""))
              continue;
            else
              return new Title(labels);
          }
        }
      }

      if (null != instanceLenses) {
        // find label lens for resource
        Iterator<Lens> instancesIt = instanceLenses.getInstanceLenses().iterator();
        while (instancesIt.hasNext()) {
          Lens check = instancesIt.next();
          if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) { 
            AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
            if (labels.getString().trim().equals(""))
              continue;
            else
              return new Title(labels);
          }
        }
      }
      if (null != classLenses) {
        // find label lens for resource
        Iterator<Lens> classesIt = classLenses.getClassLenses().iterator();
        while (classesIt.hasNext()) {
          Lens check = classesIt.next();
          if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
            AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
            if (labels.getString().trim().equals(""))
              continue;
            else
              return new Title(labels);
View Full Code Here

Examples of edu.mit.simile.fresnel.selection.Lens

        }
      }

      // get any lens-specified (property description) formatting, use instead of
      // passed in format if necessary
      Lens parent = r.getParent().getLens();
      Iterator<ISelector> psi = parent.getShowProperties().iterator();
      while (psi.hasNext()) {
        ISelector check = psi.next();
        if (check.canSelect(in, r.getParent().getOrigin(), r.getOrigin())) {
          if (check instanceof PropertyDescription) {
            PropertyDescription pd = (PropertyDescription) check;
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.