Examples of ISelector


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

     PropertySet finalProperties = resolvePropertySet(lens, in, focus);
    Iterator<ISelector> focusPSI = finalProperties.iterator();
    r.setTitle(resolveLabel(in, focus));
    this._resultModelHash.putResult(FresnelUtilities.dupResource(focus), r);
    while (focusPSI.hasNext()) {
      ISelector selector = focusPSI.next();
      if (selector.canSelectStatements()) {
        try {
          Iterator<Statement> selects = selector.selectStatements(in, focus);
          if (!selects.hasNext() &&
              (selector instanceof PropertySelector || selector instanceof PropertyDescription)) {
            if (selector instanceof PropertySelector) {
              URI predicate = ((PropertySelector) selector).getProperty();
              PropertyResult pr = r.getProperties().lookup(predicate);
              if (null == pr) {
                NoSuchPropertyResult nspr = new NoSuchPropertyResult(FresnelUtilities.dupURI(predicate), selector, r);
                nspr.setTitle(resolveLabel(in, predicate));
                r.addProperty(nspr);
                this._propertyResultModelHash.putResult(FresnelUtilities.dupURI(predicate), nspr);
                RepositoryConnection nconn = this._notModel.getConnection();
                nconn.add(FresnelUtilities.dupResource(focus), FresnelUtilities.dupURI(predicate), new LiteralImpl("empty"));
                nconn.close();
              } // if it's not null, there's nothing to do
            } else {
              Iterator<Statement> pi = ((PropertyDescription) selector).getProperty().selectStatements(in, focus);
              if (pi.hasNext()) {
                URI predicate = pi.next().getPredicate();
                PropertyResult pr = r.getProperties().lookup(predicate);
                if (null == pr) {
                  NoSuchPropertyResult nspr = new NoSuchPropertyResult(FresnelUtilities.dupURI(predicate), selector, r);
                  nspr.setTitle(resolveLabel(in, predicate));
                  r.addProperty(nspr);
                  this._propertyResultModelHash.putResult(FresnelUtilities.dupURI(predicate), nspr);
                  RepositoryConnection nconn = this._notModel.getConnection();
                  nconn.add(FresnelUtilities.dupResource(focus), FresnelUtilities.dupURI(predicate), new LiteralImpl("empty"));
                  nconn.close();
                } // if it's not null, there's nothing to do
              }
            }
          }
          while (selects.hasNext()) {
            Statement selected = selects.next();
            RepositoryConnection mconn = this._model.getConnection();
            mconn.add(selected.getSubject(), selected.getPredicate(), selected.getObject(), selected.getContext());
            mconn.commit();
            mconn.close();
            URI predicate;

            boolean inverse = !selected.getSubject().equals(focus);
            Value object = inverse ? selected.getSubject() : selected.getObject();

            if (selector instanceof PropertyDescription && ((PropertyDescription)selector).getProperty() instanceof FSESelector) {             
              predicate = new URIImpl("fsl://" + ((FSESelector)((PropertyDescription)selector).getProperty()).get_fse());
            }
            else
              predicate = selected.getPredicate();
           
            PropertyResult pr = r.getProperties().lookup(predicate, inverse);

            if (null == pr) {
              pr = new PropertyResult(FresnelUtilities.dupURI(predicate), selector, r, inverse);
              pr.setTitle(resolveLabel(in, predicate));
              r.addProperty(pr);
            //  this._propertyResultModelHash.putResult(FresnelUtilities.dupURI(predicate), pr);
            } else {
              // if somehow this property was already marked as NoSuchProperty, then
              // replace it with a real result
              if (!pr.isInModel()) {
                r.getProperties().removePropertyResult(pr);
                pr = new PropertyResult(FresnelUtilities.dupURI(predicate), selector, r);
                pr.setTitle(resolveLabel(in, predicate));
                r.addProperty(pr);
            //    this._propertyResultModelHash.putResult(FresnelUtilities.dupURI(predicate), pr);
              }
            }
           
            // cb  
            this._propertyResultModelHash.putResult(FresnelUtilities.dupURI(predicate), pr);
            if (object instanceof Resource) {
              Resource objResource = (Resource) object;
              Result subr = new Result(FresnelUtilities.dupResource(objResource), group, lens, in);
              Iterator<Statement> types = r.getTypesStatements();
              RepositoryConnection tmconn = this._typesModel.getConnection();
              tmconn.setAutoCommit(false);
              while(types.hasNext()) {
                Statement s = types.next();
                tmconn.add(s.getSubject(), s.getPredicate(), s.getObject(), s.getContext());
              }
              tmconn.commit();
              tmconn.setAutoCommit(true);
              tmconn.close();
              if (selector instanceof PropertyDescription) {
                PropertyDescription selectorPD = (PropertyDescription) selector;
                if (current == max) {
                  // 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;
                        break matched;
                      }
                    }
View Full Code Here

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

    }
    PropertySet finalProperties = resolvePropertySet(lens, in, focus);
    Iterator<ISelector> focusPSI = finalProperties.iterator();
    this._resultModelHash.putResult(FresnelUtilities.dupResource(focus), r);
    while (focusPSI.hasNext()) {
      ISelector selector = focusPSI.next();
      if (selector.canSelectStatements()) {
        try {
          Iterator<Statement> selects = selector.selectStatements(in, focus);
          while (selects.hasNext()) {
            Statement selected = selects.next();
            RepositoryConnection mconn = this._model.getConnection();
            mconn.add(FresnelUtilities.dupResource(selected.getSubject()),
                FresnelUtilities.dupURI(selected.getPredicate()),
                FresnelUtilities.dupValue(selected.getObject()));
            mconn.commit();
            mconn.close();
            URI prop = FresnelUtilities.dupURI(selected.getPredicate());
            Value object = selected.getObject();
            PropertyResult pr = r.getProperties().lookup(prop);
            if (null == pr) {
              pr = new PropertyResult(prop, selector, r);
              r.addProperty(pr);
            }
            if (object instanceof Resource) {
              Resource objResource = (Resource) object;
              if (selector instanceof PropertyDescription) {
                PropertyDescription selectorPD = (PropertyDescription) selector;
                if (current == max) {
                  ValueResult vr = new ValueResult(resolveLabel(in, objResource, false).getString(), pr, selected.getContext());
                  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());
                        pr.addValue(vr);
                        this._propertyResultModelHash.putResult(prop, pr);
                        matched = true;
View Full Code Here

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

        RepositoryConnection conn = in.getConnection();
                RepositoryResult<Statement> focusProperties = conn.getStatements(focus, (URI) null, (Value) null, true);
                RepositoryResult<Statement> focusPropertiesInverse = conn.getStatements(null, (URI) null, focus, true);
        Iterator<ISelector> showPSI = show.iterator();
        while (showPSI.hasNext()) {
          ISelector selector = showPSI.next();
          if (AllPropertiesSelector.isAllProperties(selector)) {
            // get all properties and check if in hidden properties
            while (focusProperties.hasNext() || focusPropertiesInverse.hasNext()) {
              Statement st = (focusProperties.hasNext() ? focusProperties.next() : focusPropertiesInverse.next());
              URI maybeAdd = FresnelUtilities.dupURI(st.getPredicate());
View Full Code Here

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

      // 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;
            if (pd.isGroupUse()) {
              // pick which format to use...
              Group groupFormats = (Group) pd.getUse();
              Iterator<Format> fi = groupFormats.getFormats().iterator();
              while (fi.hasNext()) {
                Format potential = fi.next();
                for (Iterator<ISelector> di = potential.getDomainSet().iterator(); di.hasNext(); ) {
                  ISelector potentialCheck = di.next();
                  if (potentialCheck.canSelect(getModel(), r.getParent().getOrigin(), r.getOrigin())) {
                    format = potential;
                    break;
                  }
                }
              }
View Full Code Here

Examples of org.jamesii.asf.spdm.generators.ISelector

    addOptimalSelector(selectors);
    List<Pair<String, List<Map<String, Object>>>> setups =
        generateBenchmarkSetups(perfDB, exploration);

    for (int i = 0; i < selectors.size(); i++) {
      ISelector selector = selectors.get(i);
      Pair<PerformancePredictorGeneratorFactory, List<PredictorPerformance>> perf =
          i == 0 ? null : selectorGeneration.selPerformances.get(i - 1);
      try {
        System.err.println("Deploying:" + selector + " / predictor:"
            + perf.getFirstValue().getClass());
View Full Code Here

Examples of org.jamesii.asf.spdm.generators.ISelector

        predictorGenerator.generatePredictor(getDataSet().getInstances(),
            getDataSet().getMetaData());
    assertNotNull(predictor);

    // Generate corresponding selector
    ISelector selector =
        SelectorGeneration.createSelector(getDataSet(), predictor);
    assertNotNull(selector);

    // Simple test run to see if comparison throws Exceptions etc.
    Features features = getDataSet().getInstances().get(0).getFeatures();
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.