Purpose -This paper aims to focus on automatic selection of two important structural concepts required in an XML query, namely, target and constraint concepts, when given a keywords query. Due to the diversities of concepts used in XML resources, it is not easy to select a correct concept when constructing an XML query. Design/methodology/approach -In this paper, a Context-based Term Weighting model that performs term weighting based on part of documents. Each part represents a specific context, thus offering better capturing of concept and term relationship. For query time analysis, a Query Context Graph and two algorithms, namely, Select Target and Constraint (QC) and Select Target and Constraint (QCAS) are proposed to find the concepts for constructing XML query. Findings -Evaluations were performed using structured document for conference domain. For constraint concept selection, the approach CTXϩTW achieved better result than its baseline, NCTX, when search term has ambiguous meanings by using context-based scoring for the concepts. CTXϩTW also shows its stability on various scoring models like BM25, TFIEF and LM. For target concept selection, CTXϩTW outperforms the standard baseline, SLCA, whereas it also records higher coverage than FCA, when structural keywords are used in query. Originality/value -The idea behind this approach is to capture the concepts required for term interpretation based on parts of the collections rather than the entire collection. This allows better selection of concepts, especially when a structured XML document consists many different types of information.