pblessing

Geometric Network DataExtraction

Discussion created by pblessing on Feb 15, 2011
Latest reply on Mar 8, 2011 by pascal_coulon
I have a geometric network with several feature classes and I'd like to perform a DataExtraction to extract only a subset of the feature classes, and more importantly a subset of the features in each feature class.  I can see why IReplicaDescription::setTableExcluded wouldn't work, since the geometric network would need to keep all its feature classes.

However, it also doesn't seem to respect the definition queries I set using IReplicaFilterDescriptionEdit::setTableUsesDefQuery and IReplicaFilterDescriptionEdit::setTableDefQuery.

Is this by design, or is this a bug?  Code snippet below.

IWorkspace source = factory.openFromFile(srcPath, 0);
IFeatureWorkspace sourceF = new IFeatureWorkspaceProxy(source);
IWorkspaceName dest = factory.create(dir, "extracted", null, 0);

NamesEnumerator nameEnum = new NamesEnumerator();
nameEnum.add(sourceF.openFeatureDataset("MyDataset").getFullName());

ReplicaDescription replica = new ReplicaDescription();
replica.init(nameEnum, dest, false, esriDataExtractionType.esriDataExtraction);
replica.setReplicaModelType(esriReplicaModelType.esriModelTypeFullGeodatabase);

String defQuery = "Flag = 1";

for (int i = 0, count = replica.getTableNameCount(); i < count; i++) {
    IName tableIName = replica.getTableName(i);
    String tableName = new IDatasetProxy(tableIName.open()).getName();

    if ("Vertex1".equals(tableName)) {
        replica.setTableExcluded(i, true);
    } else if ("Vertex2".equals(tableName)) {
        replica.setTableExcluded(i, false);
        replica.setRowsType(i, esriRowsType.esriRowsTypeFilter);
        replica.setTableUsesDefQuery(i, true);
        replica.setTableDefQuery(i, defQuery);
    } else if ("Vertex3".equals(tableName)) {
        replica.setTableExcluded(i, false);
        replica.setRowsType(i, esriRowsType.esriRowsTypeFilter);
        replica.setTableUsesDefQuery(i, true);
        replica.setTableDefQuery(i, defQuery);
    } else if ("Line1".equals(tableName)) {
        replica.setTableExcluded(i, true);
    } else if ("Line2".equals(tableName)) {
        replica.setTableExcluded(i, false);
        replica.setRowsType(i, esriRowsType.esriRowsTypeFilter);
        replica.setTableUsesDefQuery(i, true);
        replica.setTableDefQuery(i, defQuery);
    }
}

DataExtraction extraction = new DataExtraction();
extraction.extract(replica, true);

Outcomes