Returns the clustering key contained in the specified {@link CellName}.

@param document A {@link Document}.
@return The clustering key contained in the specified {@link CellName}.
334123
public final CellName clusteringKey(Document document) {
        String string = document.get(FIELD_NAME);
        ByteBuffer bb = ByteBufferUtils.fromString(string);
        return cellNameType.cellFromByteBuffer(bb);
    }
787269
private ArrayList<String> getNameInCluster(Cluster cluster) {
    ArrayList<String> itemsInCluster = new ArrayList<String>();

    String nodeName;
    if (cluster.isLeaf()) {
      nodeName = cluster.getName();
      itemsInCluster.add(nodeName);
    }
    else {
      // String[] clusterName = cluster.getName().split("#");
      // nodeName = clusterName[1];
    }

    for (Cluster child : cluster.getChildren()) {
      ArrayList<String> childrenNames = getNameInCluster(child);
      itemsInCluster.addAll(childrenNames);
    }
    return itemsInCluster;
  }
896395
private static final String getKey(ObjectNode node) {
        JsonNode apiVersion = node.get(API_VERSION);
        JsonNode kind = node.get(KIND);

        return getKey(apiVersion != null ? apiVersion.textValue() : null,
                      kind != null ? kind.textValue() : null);
    }
717667
private static Node[] _toNodeArray(Document doc, Object o) {
	if (o instanceof Node) return new Node[] { (Node) o };
	// Node[]
	if (o instanceof Node[]) return ((Node[]) o);
	// NamedNodeMap
	else if (o instanceof NamedNodeMap) {
	    NamedNodeMap map = (NamedNodeMap) o;
	    int len = map.getLength();
	    Node[] nodes = new Node[len];
	    for (int i = 0; i < len; i++) {
		nodes[i] = map.item(i);
	    }
	    return nodes;
	}
	// XMLAttributes
	else if (o instanceof XMLAttributes) {
	    return _toNodeArray(doc, ((XMLAttributes) o).toNamedNodeMap());
	}
	// NodeList
	else if (o instanceof NodeList) {
	    NodeList list = (NodeList) o;
	    int len = list.getLength();
	    Node[] nodes = new Node[len];
	    for (int i = 0; i < nodes.length; i++) {
		nodes[i] = list.item(i);
	    }
	    return nodes;
	}
	return null;
    }
111094
public I_CmsSearchDocument getDocument(int docId) {

        try {
            IndexSearcher searcher = getSearcher();
            return new CmsLuceneDocument(searcher.doc(docId));
        } catch (IOException e) {
            // ignore, return null and assume document was not found
        }
        return null;
    }
539139
private static List<String> getElementsId(Document document) {
        List<String> result = new ArrayList<String>();

        List<Element> elementList = getElements(document);

        result = getElementsId(elementList);

        return result;
    }
110027
public void printFirstOrderProbsDocument(List<IN> document) {

    CRFCliqueTree cliqueTree = getCliqueTree(document);

    // for (int i = 0; i < factorTables.length; i++) {
    for (int i = 0; i < cliqueTree.length(); i++) {
      IN wi = document.get(i);
      System.out.print(wi.get(CoreAnnotations.TextAnnotation.class) + '\t');
      for (Iterator<String> iter = classIndex.iterator(); iter.hasNext();) {
        String label = iter.next();
        int index = classIndex.indexOf(label);
        if (i == 0) {
          // double prob = Math.pow(Math.E, factorTables[i].logProbEnd(index));
          double prob = cliqueTree.prob(i, index);
          System.out.print(label + '=' + prob);
          if (iter.hasNext()) {
            System.out.print("\t");
          } else {
            System.out.print("\n");
          }
        } else {
          for (Iterator<String> iter1 = classIndex.iterator(); iter1.hasNext();) {
            String label1 = iter1.next();
            int index1 = classIndex.indexOf(label1);
            // double prob = Math.pow(Math.E, factorTables[i].logProbEnd(new
            // int[]{index1, index}));
            double prob = cliqueTree.prob(i, new int[] { index1, index });
            System.out.print(label1 + '_' + label + '=' + prob);
            if (iter.hasNext() || iter1.hasNext()) {
              System.out.print("\t");
            } else {
              System.out.print("\n");
            }
          }
        }
      }
    }
  }
63779
public static <T extends SchematicDb> T getDb(Document document) throws RuntimeException {
        return getDb(document, Schematic.class.getClassLoader());
    }
839512
private Map<String, Object> documentToPackableMap(Map<String, Object> document) {
        if (compatibleValues) {
            try {
                return jsonMapper.readValue(jsonMapper.writeValueAsBytes(document), new TypeReference<Map<String, Object>>() {
                });
            } catch (Exception e) {
                throw new RuntimeException("Cannot convert document to json and back to Map " + e.getMessage());
            }
        }

        /**
         * A document in MongoDB has a special field "_id" of type ObjectId
         * This object is not "packable" by Neo4jPacker so it must be converted to a value that Neo4j can deal with
         *
         * If the document is not null we simply override the ObjectId instance with its string representation
         */

        if (document != null) {
            Object objectId = document.get("_id");
            if (objectId != null) {
                document.put("_id", objectId.toString());
            }

        }

        return document;
    }
245173
private KeyScope readScopes(final Document doc) {
        final List<KeyScope> scopes = readScopes(doc.getDocumentElement());
        if (scopes.size() == 1 && scopes.get(0).name == null) {
            return scopes.get(0);
        } else {
            return new KeyScope("#root", null, Collections.emptyMap(), scopes);
        }
    }
839627
public final List<CellName> clusteringKeys(ColumnFamily columnFamily) {
        List<CellName> clusteringKeys = new ArrayList<>();
        CellName lastClusteringKey = null;
        for (Cell cell : columnFamily) {
            CellName cellName = cell.name();
            if (!isStatic(cellName)) {
                CellName clusteringKey = extractClusteringKey(cellName);
                if (lastClusteringKey == null || !lastClusteringKey.isSameCQL3RowAs(cellNameType, clusteringKey)) {
                    lastClusteringKey = clusteringKey;
                    clusteringKeys.add(clusteringKey);
                }
            }
        }
        return sort(clusteringKeys);
    }
239624
protected List<String> preprocess(String document)
    {
        List<Term> termList = segment.seg(document);
        ListIterator<Term> listIterator = termList.listIterator();
        while (listIterator.hasNext())
        {
            Term term = listIterator.next();
            if (CoreStopWordDictionary.contains(term.word) ||
                term.nature.startsWith("w")
                )
            {
                listIterator.remove();
            }
        }
        List<String> wordList = new ArrayList<String>(termList.size());
        for (Term term : termList)
        {
            wordList.add(term.word);
        }
        return wordList;
    }
672459
public int getValueId(Clusterable c) {
		currentItems++;
		/*
		 * if(isLeafNode()) { return id; }
		 */
		int index = TreeUtils.findNearestNodeIndex(subNodes, c);
		if (index >= 0) {
			KMeansTreeNode node = subNodes.get(index);
			return node.getValueId(c);
		}
		return id;
	}
178196
public String getDocumentId(Object instance) {
        if (instance == null) {
            return null;
        }
        DocumentInfo value = documentsByEntity.get(instance);
        return value != null ? value.getId() : null;
    }
629223
private Document getTableMetadata(SchemaTableName schemaTableName)
            throws TableNotFoundException
    {
        String schemaName = schemaTableName.getSchemaName();
        String tableName = schemaTableName.getTableName();

        MongoDatabase db = client.getDatabase(schemaName);
        MongoCollection<Document> schema = db.getCollection(schemaCollection);

        Document doc = schema
                .find(new Document(TABLE_NAME_KEY, tableName)).first();

        if (doc == null) {
            if (!collectionExists(db, tableName)) {
                throw new TableNotFoundException(schemaTableName);
            }
            else {
                Document metadata = new Document(TABLE_NAME_KEY, tableName);
                metadata.append(FIELDS_KEY, guessTableFields(schemaTableName));

                schema.createIndex(new Document(TABLE_NAME_KEY, 1), new IndexOptions().unique(true));
                schema.insertOne(metadata);

                return metadata;
            }
        }

        return doc;
    }
45645
public static List<String> getKeywordList(String document, int size)
    {
        return new TermFrequencyCounter().getKeywords(document, size);
    }
743022
public function getShardKeyQuery($document)
    {
        if ( ! $this->class->isSharded()) {
            return array();
        }

        $shardKey = $this->class->getShardKey();
        $keys = array_keys($shardKey['keys']);
        $data = $this->uow->getDocumentActualData($document);

        $shardKeyQueryPart = array();
        foreach ($keys as $key) {
            $mapping = $this->class->getFieldMappingByDbFieldName($key);
            $this->guardMissingShardKey($document, $key, $data);
            $value = Type::getType($mapping['type'])->convertToDatabaseValue($data[$mapping['fieldName']]);
            $shardKeyQueryPart[$key] = $value;
        }

        return $shardKeyQueryPart;
    }