Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/URSUnits2CQPWordsMacro.groovy
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/URSUnits2CQPWordsMacro.groovy	(revision 3350)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/URSUnits2CQPWordsMacro.groovy	(revision 3351)
@@ -19,17 +19,20 @@
 }
 
 @Field @Option(name="unit_type", usage="Corpus name in uppercase", widget="String", required=true, def="Entity")
-String unit_type
+		String unit_type
 
-@Field @Option(name="unit_properties", usage="Corpus name in uppercase", widget="String", required=true, def="Property")
-String unit_properties
+@Field @Option(name="unit_properties", usage=" * or comma separated list of properties names", widget="String", required=true, def="Property")
+		String unit_properties
+		
+@Field @Option(name="unit_internal_properties", usage="Corpus name in uppercase", widget="Boolean", required=true, def="false")
+def unit_internal_properties
 
-@Field @Option(name="unit_word", usage="Corpus name in uppercase", widget="StringArray", metaVar="START	END", required=true, def="START")
-String unit_word
+@Field @Option(name="unit_word", usage="CQP word position to annotate", widget="StringArray", metaVar="START	END", required=true, def="START")
+		String unit_word
 
 if (!ParametersDialog.open(this)) return
 
-MainCorpus corpus = corpusViewSelection
+def corpus = corpusViewSelection
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
 def texts = corpus.getCorpusTextIdsList();
@@ -39,53 +42,54 @@
 for (int i = 0 ; i < texts.size() ; i++) {
 	
 	println "Processing annotations of "+texts[i]+"..."
-
+	
 	def text_id = texts[i]
 	def text_start = texts_startlimits[i]
 	def text_end = texts_endlimits[i]
-
+	
 	File xmltxmFile = new File(corpus.getProject().getProjectDirectory(), "txm/"+corpus.getID()+"/"+text_id+".xml")
 	File xmltxmFileCopy = new File(corpus.getProject().getProjectDirectory(), text_id+"_copy.xml")
-
+	
 	if (!xmltxmFile.exists()) {
 		println "Warning: no text file found: "+xmltxmFile
 		continue
 	}
 	
-	for (String uType : analecCorpus.getStructure().getTypes(Unite.class)) {
-		def corpus_units = []
-		ArrayList<Unite> all_units = analecCorpus.getUnites(uType)
-		corpus_units = all_units.findAll() {
-			unit_type.equals(it.getProp("type")) && text_start <= it.getDeb() && it.getFin() < text_end
-		}
-		
-		if (corpus_units.size() == 0) continue;
-		
-		try {
-			println " processing word Units ${text_id} and its '$uType' units ("+corpus_units.size()+")"
-			WordUnitsInserter inserter = new WordUnitsInserter(corpus, xmltxmFile, corpus_units, unit_properties, unit_word);
-			if (inserter.process(xmltxmFileCopy) && ValidateXml.test(xmltxmFileCopy)) {
-				xmltxmFile.delete()
-				xmltxmFileCopy.renameTo(xmltxmFile)
-
-				println "Done, "+corpus_units.size()+ " units written"
-
-			} else {
-				println "Error while processing the XML-TXM $xmltxmFile file"
-				File error = new File(corpus.getProject().getProjectDirectory(), "error/"+xmltxmFile.getName())
-				error.getParentFile().mkdirs()
-				println "	moving created file to $error"
-				error.delete()
-				xmltxmFileCopy.renameTo(error)
-			}
-		} catch(Exception e) {
-			println "Error while processing milestones $xmltxmFile file: "+e
-			e.printStackTrace();
+	def corpus_units = []
+	ArrayList<Unite> all_units = analecCorpus.getUnites(unit_type)
+	corpus_units = all_units.findAll() {
+		text_start <= it.getDeb() && it.getFin() < text_end
+	}
+	
+	if (corpus_units.size() == 0) {
+		println " No '$unit_type' unit found."
+		continue;
+	}
+	
+	try {
+		println " Processing word Units ${text_id} and its '$unit_type' units ("+corpus_units.size()+")"
+		WordUnitsInserter inserter = new WordUnitsInserter(corpus, xmltxmFile, corpus_units, unit_properties, unit_word, unit_internal_properties);
+		if (inserter.process(xmltxmFileCopy) && ValidateXml.test(xmltxmFileCopy)) {
+			xmltxmFile.delete()
+			xmltxmFileCopy.renameTo(xmltxmFile)
+			
+			println "Done, "+corpus_units.size()+ " units written"
+			
+		} else {
+			println "Error while processing the XML-TXM $xmltxmFile file"
 			File error = new File(corpus.getProject().getProjectDirectory(), "error/"+xmltxmFile.getName())
 			error.getParentFile().mkdirs()
 			println "	moving created file to $error"
 			error.delete()
 			xmltxmFileCopy.renameTo(error)
 		}
+	} catch(Exception e) {
+		println "Error while processing milestones $xmltxmFile file: "+e
+		e.printStackTrace();
+		File error = new File(corpus.getProject().getProjectDirectory(), "error/"+xmltxmFile.getName())
+		error.getParentFile().mkdirs()
+		println "	moving created file to $error"
+		error.delete()
+		xmltxmFileCopy.renameTo(error)
 	}
 }
\ No newline at end of file
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/WordUnitsInserter.groovy
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/WordUnitsInserter.groovy	(revision 3350)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/cqp/WordUnitsInserter.groovy	(revision 3351)
@@ -21,13 +21,15 @@
 	File inputFile
 	def id2Units = [:]
 	def unit_properties // "*" or list (String)
+	def unit_internal_properties = false
 	def unit_word // ALL START END
 	LinkedHashMap<String, String> anaValues = new LinkedHashMap<String, String>();
 
-	public WordUnitsInserter(MainCorpus corpus, File inputFile, List<Unite> units, String unit_properties, String unit_word) {
+	public WordUnitsInserter(MainCorpus corpus, File inputFile, List<Unite> units, String unit_properties, String unit_word, boolean unit_internal_properties) {
 		super(inputFile)
 		this.inputFile = inputFile
 		
+		this.unit_internal_properties = unit_internal_properties
 		this.unit_properties = unit_properties
 		this.unit_word = unit_word
 		if (!("*".equals(unit_properties))) {
@@ -84,10 +86,16 @@
 						
 						if (!anaValues.containsKey(p)) {
 							anaValues[p] = ""
-							ana_resp = "#txm"
+							ana_resp = "#urs"
 						}
 						anaValues[p] = (anaValues[p]+" "+props.get(p)).trim()
 					}
+					if (unit_internal_properties) {
+	
+						anaValues["urs-type"] = u.getType()
+						anaValues["urs-start"] = ""+u.getDeb()
+						anaValues["urs-end"] = ""+u.getFin()
+					}
 				}
 				if (anaValues.size() > 0) println anaValues
 			}
