You can find an overview of structure learning in Koller & Friedmans book on Probabilistic Graphical Models. Maybe the book can answer the second question, too.
We obtained causal structures from medicine and other experts by structured interviews several years ago. Now Mark Eilers and I learned relevant variables in single connected networks. You have to check our publications. For the latter approach there is a brand new publication presented at Cognitive 2014 in Venice.
Hi Lindani, we have used BN for compiler optimizations using the package Mateda 2.0 in matlab, check the paper here with my comment. You can set the engine to infer based on probability distribution and relate even discrete parameters to continius such as performance metrics. In a few days i can provide you with our paper as I am waiting it to be accepted. Cheers :-)
Article Mateda-2.0: Estimation of distribution algorithms in MATLAB
Learning the structure of Bayesian networks is pretty much bread and butter in this business and most software supports this. GeNIe (http://www.bayesfusion.com/) is free for academic research and teaching.