src/snac/client/openrefine/ORConstellationMapper.php
/**
     * Map OR query data to Constellation
     *
     * Maps OpenRefine query data, based on the properties allowed,
     * into a Constellation object.
     *
     * The OpenRefine suggest API provides a list of properties that
     * the user can connect to the column to be reconciled.  The list we
     * allowed is provided in this class.  When the reconcile query happens,
     * each OR row that has data for that property is provided in the
     * properties array.  The array contains objects with:
     * - pid - The property ID as we define in this class
     * - v - The value from OpenRefine data.
     *
     * @param array $query The OpenRefine query with data to be mapped
     * @return \snac\data\Constellation A Constellation object with that data
     */
Map OR query data to Constellation
Maps OpenRefine query data, based on the properties allowed,
into a Constellation object.

The OpenRefine suggest API provides a list of properties that
the user can connect to the column to be reconciled.  The list we
allowed is provided in this class.  When the reconcile query happens,
each OR row that has data for that property is provided in the
properties array.  The array contains objects with:
- pid - The property ID as we define in this class
- v - The value from OpenRefine data.

@param array $query The OpenRefine query with data to be mapped
@return \snac\data\Constellation A Constellation object with that data
Map OR query data to Constellation Maps OpenRefine query data based on the properties allowed into a Constellation object . The OpenRefine suggest API provides a list of properties that the user can connect to the column to be reconciled . The list we allowed is provided in this class . When the reconcile query happens each OR row that has data for that property is provided in the properties array . The array contains objects with : - pid - The property ID as we define in this class - v - The value from OpenRefine data . @param array $query The OpenRefine query with data to be mapped @return \ snac \ data \ Constellation A Constellation object with that data
public function mapConstellation($query) {
        $testC = new \snac\data\Constellation();
        $testN = new \snac\data\NameEntry();
        $testN->setOriginal($query["query"]);
        $testC->addNameEntry($testN);
        if (isset($query["properties"])) {
            foreach ($query["properties"] as $p) {
                if ($p["pid"] == "sameAs") {
                    $sameas = new \snac\data\SameAs();
                    $sameas->setURI($p["v"]);
                    $sameasType = $this->vocabStringLookup("record_type", "sameAs");
                    $sameas->setType($sameasType);
                    $testC->addOtherRecordID($sameas);
                } else if ($p["pid"] == "entityType") {
                    $entityType = $this->vocabStringLookup("entity_type", $p["v"]);
                    $testC->setEntityType($entityType);
                }             
            }
        }
        return $testC;
    }
public function mapConstellation ( $ query ) { $ testC = new \ snac \ data \ Constellation ( ) ; $ testN = new \ snac \ data \ NameEntry ( ) ; $ testN -> setOriginal ( $ query [ " query " ] ) ; $ testC -> addNameEntry ( $ testN ) ; if ( isset ( $ query [ " properties " ] ) ) { foreach ( $ query [ " properties " ] as $ p ) { if ( $ p [ " pid " ] == " sameAs " ) { $ sameas = new \ snac \ data \ SameAs ( ) ; $ sameas -> setURI ( $ p [ " v " ] ) ; $ sameasType = $ this -> vocabStringLookup ( " record_type " , " sameAs " ) ; $ sameas -> setType ( $ sameasType ) ; $ testC -> addOtherRecordID ( $ sameas ) ; } else if ( $ p [ " pid " ] == " entityType " ) { $ entityType = $ this -> vocabStringLookup ( " entity_type " , $ p [ " v " ] ) ; $ testC -> setEntityType ( $ entityType ) ; } } } return $ testC ; }
Map OR query data to Constellation
 Maps OpenRefine query data, based on the properties allowed,
 into a Constellation object.
Map OR query data to Constellation Maps OpenRefine query data based on the properties allowed into a Constellation object .