Package uk.org.ogsadai.tuple

Examples of uk.org.ogsadai.tuple.ColumnMetadata


        Map<String, SType> elements = tupleType.getElements();
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>(elements.size());
        for (Entry<String, SType> element : elements.entrySet())
        {
            int type = getTupleType(element.getValue());
            ColumnMetadata column =
                new SimpleColumnMetadata(
                        element.getKey(),
                        type,
                        0,
                        ColumnMetadata.COLUMN_NULLABLE,
View Full Code Here


        Map<String, Object> value = (Map<String, Object>) literals.get(1);
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>(value.size());
        for (Entry<String, Object> entry : value.entrySet())
        {
            int type = getTupleType(entry.getValue());
            ColumnMetadata column =
                new SimpleColumnMetadata(
                        entry.getKey(),
                        type,
                        0,
                        ColumnMetadata.COLUMN_NULLABLE,
View Full Code Here

  }

  private MetadataWrapper prepareMetadata(TupleListIterator tuples) throws ActivityUserException, ActivityProcessingException, ActivityTerminatedException {
        TupleMetadata prevMetadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        ColumnMetadata column = new SimpleColumnMetadata(prevMetadata.getColumnMetadata(0).getName(), TupleTypes._STRING, 0, 0, 0);
        columns.add(column);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
    return new MetadataWrapper(metadata);
  }
View Full Code Here

            (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        try
        {
          boolean isNumeric = classifiers.get(0).classifier.classIsNumeric();
            mOutput.write(ControlBlock.LIST_BEGIN);
            ColumnMetadata column;
            if (isNumeric)
            {
                column = new SimpleColumnMetadata("class", TupleTypes._DOUBLE, 0, 0, 0);               
            }
            else
View Full Code Here

    public void configure(TupleMetadata metadata) throws ActivityUserException
    {
        Set<String> columns = new HashSet<String>(mColumnNamesMapping.keySet());
        for (int i=0; i<metadata.getColumnCount(); i++)
        {
            ColumnMetadata column = metadata.getColumnMetadata(i);
            Integer mapto = mColumnNamesMapping.get(column.getName());
            if (mapto != null)
            {
                mColumnMapping.put(i, mapto);
                columns.remove(column.getName());
            }
            else
            {
                throw new ColumnNotFoundException(column.getName());
            }
        }
        if (columns.size() > 1)
        {
            throw new ActivityUserException(
View Full Code Here

        try
        {
            classifier.configure(metadata);
            boolean isNumeric = classifier.classIsNumeric();
            mOutput.write(ControlBlock.LIST_BEGIN);
            ColumnMetadata column;
            if (isNumeric)
            {
                column = new SimpleColumnMetadata(resultColumnName, TupleTypes._DOUBLE, 0, 0, 0);               
            }
            else
View Full Code Here

    {
        ArrayList<Attribute> result = new ArrayList<Attribute>();
        for (int i=0;  i<metadata.getColumnCount(); i++)
        {
            Attribute attribute;
            ColumnMetadata column = metadata.getColumnMetadata(i);
            if (nominalValues != null)
            {
                List<Object> values = nominalValues.get(i);
                if (values != null)
                {
                    List<String> nomVal = new ArrayList<String>();
                    for (Object value : values)
                    {
                        // nominal values must be strings
                        nomVal.add(value.toString());
                    }
                    attribute = new Attribute(column.getName(), nomVal);
                }
                else
                {
                    attribute = createAttributeForType(column);
                }
View Full Code Here

   
            mResultOutput.write(ControlBlock.LIST_BEGIN);
           
            List<ColumnMetadata> columnsMetadata = new ArrayList<ColumnMetadata>();
            for(int i=0;i<columnNames.size();i++) {
              ColumnMetadata column;
              if (values.size() > 0 && values.get(0).size() > 0 && values.get(0).get(i) instanceof String)
              {
                  column = new SimpleColumnMetadata(columnNames.get(i), TupleTypes._STRING, 0, 0, 0);           
              }
              else
View Full Code Here

                  while(tokenizer.hasMoreTokens())
              {
                data.add(tokenizer.nextToken());
              }

          ColumnMetadata columnMetaData = new SimpleColumnMetadata("BOGUS_COLUMN_NAME", 1, 1, 1, 1);
          List listColumnMetadata = new ArrayList();
          for (int i=0; i<data.size(); i++)
          {
            listColumnMetadata.add(columnMetaData);
          }
View Full Code Here

    {
      ClassifyActivity activity = new ClassifyActivity();
       
        Object data = new double[]{0.0, 1.1, 2.2, 3.3};

        ColumnMetadata columnMetadata = new SimpleColumnMetadata
            ("extracted", TupleTypes._OBJECT, 0, ColumnMetadata.COLUMN_NO_NULLS, 0);
        TupleMetadata tupleMetadata =
          new SimpleTupleMetadata(Collections.singletonList(columnMetadata));
        MetadataWrapper metadataWrapper = new MetadataWrapper(tupleMetadata);
   
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.tuple.ColumnMetadata

Copyright © 2018 www.massapicom. 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.