Search in sources :

Example 1 with FeatureSet

use of org.apache.jena.sdb.store.FeatureSet in project jena by apache.

the class StoreDescAssembler method open.

@Override
public StoreDesc open(Assembler a, Resource root, Mode mode) {
    SDBConnectionDesc sdbConnDesc = null;
    Resource c = GraphUtils.getResourceValue(root, AssemblerVocab.pConnection);
    if (c != null)
        sdbConnDesc = (SDBConnectionDesc) a.open(c);
    String layoutName = GraphUtils.getStringValue(root, AssemblerVocab.pLayout);
    String dbType = chooseDBType(root, sdbConnDesc);
    // Features
    List<Resource> x = GraphUtils.multiValueResource(root, AssemblerVocab.featureProperty);
    FeatureSet fSet = new FeatureSet();
    for (Resource r : x) {
        String n = GraphUtils.getStringValue(r, AssemblerVocab.featureNameProperty);
        String v = GraphUtils.getStringValue(r, AssemblerVocab.featureValueProperty);
        Feature f = new Feature(new Feature.Name(n), v);
        fSet.addFeature(f);
    }
    StoreDesc storeDesc = new StoreDesc(layoutName, dbType, fSet);
    storeDesc.connDesc = sdbConnDesc;
    // MySQL specials
    String engineName = GraphUtils.getStringValue(root, AssemblerVocab.pMySQLEngine);
    storeDesc.engineType = null;
    if (engineName != null)
        try {
            storeDesc.engineType = MySQLEngineType.convert(engineName);
        } catch (SDBException ex) {
        }
    // SAP specials
    String storageType = GraphUtils.getStringValue(root, AssemblerVocab.pStorageType);
    if (storageType != null)
        try {
            storeDesc.storageType = SAPStorageType.convert(storageType);
        } catch (SDBException ex) {
        }
    return storeDesc;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBException(org.apache.jena.sdb.SDBException) SDBConnectionDesc(org.apache.jena.sdb.sql.SDBConnectionDesc) Resource(org.apache.jena.rdf.model.Resource) FeatureSet(org.apache.jena.sdb.store.FeatureSet) Feature(org.apache.jena.sdb.store.Feature)

Aggregations

Resource (org.apache.jena.rdf.model.Resource)1 SDBException (org.apache.jena.sdb.SDBException)1 StoreDesc (org.apache.jena.sdb.StoreDesc)1 SDBConnectionDesc (org.apache.jena.sdb.sql.SDBConnectionDesc)1 Feature (org.apache.jena.sdb.store.Feature)1 FeatureSet (org.apache.jena.sdb.store.FeatureSet)1