示例#1
0
 @Override
 protected Model processMethod() throws AsyncException {
   Model m = ModelFactory.createDefaultModel();
   m.setNsPrefix("lmap", "http://jena.hpl.hp.com/2004/08/location-mapping#");
   toModel(getHandler(""), m);
   return m;
 }
示例#2
0
    @Override
    protected Serializable processMethod() throws AsyncException {
      for (Iterator<String> iter = altLocations.keySet().iterator(); iter.hasNext(); ) {
        Resource r = model.createResource();
        Resource e = model.createResource();
        model.add(getHandler(""), r, LocationMappingVocab.mapping, e);

        String k = iter.next();
        String v = altLocations.get(k);
        model.add(getHandler(""), e, LocationMappingVocab.name, k);
        model.add(getHandler(""), e, LocationMappingVocab.altName, v);
      }

      for (Iterator<String> iter = altPrefixes.keySet().iterator(); iter.hasNext(); ) {
        Resource r = model.createResource();
        Resource e = model.createResource();
        model.add(getHandler(""), r, LocationMappingVocab.mapping, e);
        String k = iter.next();
        String v = altPrefixes.get(k);
        model.add(getHandler(""), e, LocationMappingVocab.prefix, k);
        model.add(getHandler(""), e, LocationMappingVocab.altPrefix, v);
      }

      return null;
    }
示例#3
0
    @Override
    protected Serializable processMethod() throws AsyncException {
      StmtIterator mappings =
          m.listStatements(
              getHandler("mappings"), null, LocationMappingVocab.mapping, (RDFNode) null);

      for (; mappings.hasNext(); ) {
        Statement s = mappings.nextStatement();
        Resource mapping = s.getResource();

        if (mapping.hasProperty(getHandler(""), LocationMappingVocab.name)) {
          try {
            String name =
                mapping
                    .getRequiredProperty(getHandler("name"), LocationMappingVocab.name)
                    .getString();
            String altName =
                mapping
                    .getRequiredProperty(getHandler("altName"), LocationMappingVocab.altName)
                    .getString();
            addAltEntry(name, altName);
            log.log(Level.ALL, "Mapping: " + name + " => " + altName);
            //		                    log.debug("Mapping: "+name+" => "+altName) ;
          } catch (JenaException ex) {
            log.log(Level.ALL, "Error processing name mapping: " + ex.getMessage());
            //		                    log.warn("Error processing name mapping: "+ex.getMessage()) ;
            return null;
          }
        }

        if (mapping.hasProperty(getHandler(""), LocationMappingVocab.prefix)) {
          try {
            String prefix =
                mapping
                    .getRequiredProperty(getHandler("prefix"), LocationMappingVocab.prefix)
                    .getString();
            String altPrefix =
                mapping
                    .getRequiredProperty(getHandler("altPrefix"), LocationMappingVocab.altPrefix)
                    .getString();
            addAltPrefix(prefix, altPrefix);
            log.log(Level.ALL, "Prefix mapping: " + prefix + " => " + altPrefix);
            //		                    log.debug("Prefix mapping: "+prefix+" => "+altPrefix) ;
          } catch (JenaException ex) {
            log.log(Level.ALL, "Error processing prefix mapping: " + ex.getMessage());
            //		                    log.warn("Error processing prefix mapping: "+ex.getMessage()) ;
            return null;
          }
        }
      }

      return null;
    }
示例#4
0
/**
 * Vocabulary definitions from result-set.n3
 *
 * @author Auto-generated by schemagen on 10 Jun 2006 18:47
 */
public class ResultSetGraphVocab {

  private ResultSetGraphVocab() {
    try {
      Setup_ResultSetGraphVocab setup = new Setup_ResultSetGraphVocab();
      setup.controlMethod();
    } catch (Exception ex) {
      System.out.print(ex.getStackTrace());
    }
  }

  /** The RDF model that holds the vocabulary terms */
  private static Model m_model = ModelFactory.createDefaultModel();

  /** The namespace of the vocabulary as a string */
  public static String NS = "http://www.w3.org/2001/sw/DataAccess/tests/result-set#";

  /**
   * The namespace of the vocabulary as a string
   *
   * @see #NS
   */
  public static String getURI() {
    return NS;
  }

  /** The namespace of the vocabulary as a resource */
  public static Resource NAMESPACE = m_model.createResource(NS);

  /** Boolean result */
  public static Property p_boolean;

  /** Variable name */
  public static Property value;

  /** Variable name */
  public static Property variable;

  /** Index for ordered result sets */
  public static Property index;

  /**
   * Multi-occurrence property associating a result solution (row) resource to a single (variable,
   * value) binding
   */
  public static Property binding;

  /** MultivaluedName of a variable used in the result set */
  public static Property resultVariable;

  /** Number of rows in the result table */
  public static Property size;

  public static Property solution;

  /** Class of things that represent a single (variable, value) pairing */
  public static Resource ResultBinding;

  /** Class of things that represent a row in the result table - one solution to the query */
  public static Resource ResultSolution;

  /** Class of things that represent the result set */
  public static Resource ResultSet;

  class Setup_ResultSetGraphVocab extends AsyncHandler<Serializable> {

    public Setup_ResultSetGraphVocab() throws AsyncException {
      super("Setup_ResultSetGraphVocab");
    }

    @Override
    protected Serializable processMethod() throws AsyncException {
      NAMESPACE = m_model.createResource(NS);
      p_boolean =
          m_model.createProperty(
              getHandler("p_boolean"),
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#boolean");
      value =
          m_model.createProperty(
              getHandler("value"), "http://www.w3.org/2001/sw/DataAccess/tests/result-set#value");
      variable =
          m_model.createProperty(
              getHandler("variable"),
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#variable");
      index =
          m_model.createProperty(
              getHandler("index"), "http://www.w3.org/2001/sw/DataAccess/tests/result-set#index");
      binding =
          m_model.createProperty(
              getHandler("binding"),
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#binding");
      resultVariable =
          m_model.createProperty(
              getHandler("resultVariable"),
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#resultVariable");
      size =
          m_model.createProperty(
              getHandler("size"), "http://www.w3.org/2001/sw/DataAccess/tests/result-set#size");
      solution =
          m_model.createProperty(
              getHandler(""), "http://www.w3.org/2001/sw/DataAccess/tests/result-set#solution");
      ResultBinding =
          m_model.createResource(
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultBinding");
      ResultSolution =
          m_model.createResource(
              "http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSolution");
      ResultSet =
          m_model.createResource("http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet");

      return null;
    }

    @Override
    protected void syncVars(Sync sync) {}
  }
}