Not sure if this is a bug or a feature.
Anyway, using attvar s_domain (similar to "domain" as defined in http://www.swi-prolog.org/pldoc/doc_for?object=section(%27sec:attvar%27) ), you can see that the 2nd line of output) from writeq doesn't show the domain information. Perhaps this is because it's assumed that the output of writeq can be read back in, but in the case of attvars, reading it back in would produce something a bit different from the original.
?- s_domain(X, [1,2,4]), Z = '<f>'(X), write(Z), nl, writeq(Z), nl. <f>(_h409 { s_domain : [1,2,4] } ) '<f>'(_h409) X = _h409 { s_domain : [1,2,4] } Z = <f>(_h409 { s_domain : [1,2,4] } )
grrr .. should be a "wrong answer (maybe)" bug report but I don't have a way of changing the "milestone".