I would like to construct a mechanism that constructs different facts depending from txt file, imported in prolog. I already have found some examples where they directly assert
yes - you need to do what you'd do in any other language.
Open and read the file, parse the contents, and convert into terms that you can then assert.
Fortunately, you're in prolog, so 'parse the contents' is a task the language does for breakfast.
It turns out I've been writing a tutorial on how to do pretty much this exact task. It's not quite finished, but is online at
http://www.pathwayslms.com/swipltuts/dcg/
If your files are large, use the method described in the tutorial to read them. Otherwise, just bring the file into a 'codes' style string and go on with life.