Examples of MapParser


Examples of com.firefly.utils.json.parser.MapParser

              if (!((key instanceof Class) && key == String.class))
                throw new JsonException("not support the " + method);
             
              Type elementType = types2[1];
              parserMetaInfo.setType(ComplexTypeParser.getImplClass(type));
              parserMetaInfo.setParser(new MapParser(elementType));
            } else { // 获取对象、枚举或者数组Parser
              parserMetaInfo.setType(type);
              parserMetaInfo.setParser(ParserStateMachine.getParser(type));
            }
            fieldSet.add(parserMetaInfo);
    }
   
    for(Field field : clazz.getFields()) { // public字段反序列化构造
      if(Modifier.isTransient(field.getModifiers()) || field.isAnnotationPresent(Transient.class) || Modifier.isStatic(field.getModifiers()))
        continue;
     
      field.setAccessible(true);
     
      ParserMetaInfo parserMetaInfo = new ParserMetaInfo();
            parserMetaInfo.setPropertyNameString(field.getName());
            parserMetaInfo.setPropertyInvoke(new FieldInvoke(field));
           
            Class<?> type = field.getType();
            if (Collection.class.isAssignableFrom(type)) {
              Type fieldType = field.getGenericType();
              if(!(fieldType instanceof ParameterizedType))
                throw new JsonException("not support the " + field);
             
              ParameterizedType paramType = (ParameterizedType)fieldType;
              Type[] types2 = paramType.getActualTypeArguments();
              if(types2.length != 1)
                throw new JsonException("not support the " + field);
             
              Type elementType = types2[0];
              parserMetaInfo.setType(ComplexTypeParser.getImplClass(type));
              parserMetaInfo.setParser(new CollectionParser(elementType));
            } else if (Map.class.isAssignableFrom(type)) { // Map元信息构造
              Type fieldType = field.getGenericType();
              if(!(fieldType instanceof ParameterizedType))
                throw new JsonException("not support the " + field);
             
              ParameterizedType paramType = (ParameterizedType) fieldType;
              Type[] types2 = paramType.getActualTypeArguments();
              if(types2.length != 2)
                throw new JsonException("not support the " + field);
             
              Type key = types2[0];
              if (!((key instanceof Class) && key == String.class))
                throw new JsonException("not support the " + field);
             
              Type elementType = types2[1];
              parserMetaInfo.setType(ComplexTypeParser.getImplClass(type));
              parserMetaInfo.setParser(new MapParser(elementType));
            } else { // 获取对象、枚举或者数组Parser
              parserMetaInfo.setType(type);
              parserMetaInfo.setParser(ParserStateMachine.getParser(type));
            }
            fieldSet.add(parserMetaInfo);
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

   * @param mapModel a Jena model containing the D2RQ map
   * @param baseURIForData Base URI for turning relative URI patterns into
   *     absolute URIs; if <tt>null</tt>, then D2RQ will pick a base URI
   */
  public ModelD2RQ(Model mapModel, String baseURIForData) {
    super(new GraphD2RQ(new MapParser(mapModel,
        (baseURIForData == null) ? "http://localhost/resource/" : baseURIForData).parse()), BuiltinPersonalities.model); // BuiltinPersonalities.model really required?
  }
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

    return mapModel;
  }

  public Mapping getMapping() {
    if (mapping == null) {
      mapping = new MapParser(getMappingModel(), getResourceBaseURI()).parse();
      mapping.configuration().setUseAllOptimizations(fastMode);
      if (connectedDB != null) {
        // Hack! We don't want the Database to open another ConnectedDB,
        // so we check if it's connected to the same DB, and in that case
        // make it use the existing ConnectedDB that we already have opened.
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

  private String complexQuery;

  protected void setUp() throws Exception {
    mapModel = ModelFactory.createDefaultModel();
    mapModel.read(D2RQTestSuite.ISWC_MAP, "http://test/", "TURTLE");
    MapParser parser = new MapParser(mapModel, null);
    databases = parser.parse().databases();
    firstDatabase = (Database)databases.iterator().next();
    simplestQuery = "SELECT 1;";
    // mediumQuery = "SELECT PaperID from papers";
    mediumQuery = "SELECT DISTINCT papers.PaperID FROM rel_paper_topic, papers, topics WHERE papers.PaperID=rel_paper_topic.PaperID AND rel_paper_topic.TopicID=topics.TopicID AND topics.TopicID=3 AND rel_paper_topic.RelationType = 1 AND papers.Publish = 1;";
    complexQuery = "SELECT T0_Papers.PaperID, T0_Persons.URI, T1_Persons.Email, T1_Persons.URI FROM persons AS T1_Persons, papers AS T0_Papers, rel_person_paper AS T0_Rel_Person_Paper, persons AS T0_Persons WHERE T0_Persons.PerID=T0_Rel_Person_Paper.PersonID AND T0_Papers.PaperID=T0_Rel_Person_Paper.PaperID AND T0_Papers.Publish = 1 AND T0_Persons.URI=T1_Persons.URI AND (NOT (CONCAT('http://www.conference.org/conf02004/paper#Paper' , CAST(T0_Papers.PaperID AS char) , '') = T0_Persons.URI));";
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

    MappingGenerator generator = new MappingGenerator(cdb);
    return generator.mappingModel(EX);
  }
 
  private Mapping generateDefaultMapping() {
    return new MapParser(generateDefaultMappingModel(), EX).parse();
  }
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

   * @param testFileName Filename, relative to {@link D2RQTestSuite}'s location
   * @return A mapping
   * @throws D2RQException On error during parse
   */
  public static Mapping readFromTestFile(String testFileName) {
    return new MapParser(
        D2RQTestSuite.loadTurtle(testFileName),
        "http://example.org/").parse();
  }
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

  public static void main(String[] args) {
    // Load mapping file
    Model mapModel = FileManager.get().loadModel("doc/example/mapping-iswc.ttl");
   
    // Parse mapping file
    MapParser parser = new MapParser(mapModel, "http://localhost:2020/");
    Mapping mapping = parser.parse();
   
    // Set up the GraphD2RQ
    GraphD2RQ g = new GraphD2RQ(mapping);

    // Create a find(spo) pattern
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.parser.MapParser

  public static Collection<TripleRelation> loadPropertyBridges(String mappingFileName) {
    Model m = ModelFactory.createDefaultModel();
    Resource dummyDB = m.getResource(Test.DummyDatabase.getURI());
    dummyDB.addProperty(RDF.type, D2RQ.Database);
    m.read(D2RQTestSuite.class.getResourceAsStream(mappingFileName), null, "TURTLE");
    Mapping mapping = new MapParser(m, null).parse();
    return mapping.compiledPropertyBridges();
  }
View Full Code Here

Examples of org.apache.xmlrpc.parser.MapParser

                    }
                });
      } else if (ObjectArraySerializer.ARRAY_TAG.equals(pLocalName)) {
        return new ObjectArrayParser(pConfig, pContext, this);
      } else if (MapSerializer.STRUCT_TAG.equals(pLocalName)) {
        return new MapParser(pConfig, pContext, this);
      } else if (ByteArraySerializer.BASE_64_TAG.equals(pLocalName)) {
        return new ByteArrayParser();
      } else if (StringSerializer.STRING_TAG.equals(pLocalName)) {
        return new StringParser();
      }
View Full Code Here

Examples of org.apache.xmlrpc.parser.MapParser

                    }
                });
      } else if (ObjectArraySerializer.ARRAY_TAG.equals(pLocalName)) {
        return new ObjectArrayParser(pConfig, pContext, this);
      } else if (MapSerializer.STRUCT_TAG.equals(pLocalName)) {
        return new MapParser(pConfig, pContext, this);
      } else if (ByteArraySerializer.BASE_64_TAG.equals(pLocalName)) {
        return new ByteArrayParser();
      } else if (StringSerializer.STRING_TAG.equals(pLocalName)) {
        return new StringParser();
      }
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.