To go more in detail, my professor stated that Germany wanted oil in Mesopotamia, and the Ottoman's had the best avenue for that control. So a proposed railroad was the way for Germany (plus Austria-Hungary) to get the oil. However, Serbia did not wish for Austria-Hungary to gain even more influence over them and fought against the railroad being built. To suppress Serbia, Franz Ferdinand would be sent there (unbeknownst to him) and killed, sparking a "regional war" where Serbia would lose and the railroad could be built.
How factual is this claim? I always saw it as a complex web of nationalistic attitudes rather a resource grab. Am I wrong?
I wrote a thesis on the First Balkan War, so I will tell you what I know from my research but I can't answer the entire question.
The backdrop to this whole situation is a boiling point of ethnic tensions in the Balkans. Events like the Baghdad-Berlin railroad construction and even the assassination of Franz Ferdinand were excuses to escalate tensions that had existed for centuries and were almost always worsening. The Balkan Wars of 1912-13 are one example - it's easy to forget that, for the Balkans and the Ottoman Empire, the First World War essentially started in 1912. This was the regional war your professor mentioned - and, as you may have noticed, it lulled the European Powers into a sense that any future wars would be similarly limited in scope. This was what my thesis was about - the false sense of security, especially among the British (who were extremely diplomatically active in the Balkans trying to leverage influence in disputes like these), that the Balkan countries were just some meddling kids going through their angsty teen phase, and that the tension there would stay put.
The main issue with your professor's claim is, I think, that there was already a railway from Berlin to Istanbul by around 1890. I'm going off this image from the Wikimedia Commons but I would love for someone with a deeper understanding of that situation to corroborate Wikipedia's claim. I know more securely that the Berlin-Baghdad railroad faced huge delays on the Baghdad side, thanks both to the difficult landscape and the Balkan Wars emptying the Ottoman treasury.
Overall, to call the First World War a war about oil is a little simplistic to me. Material factors played a huge role, but so did social Darwinism, the idea that the material successes and failures of countries and ethnic groups is linked to the biology of the people living there. And so did sexism, by which I mean the concept that manhood is earned through combat, and there hadn't been a war among the industrialized powers in a good while. So, too, did plain old bigotry. One local English paper from shortly before the war reports thusly -
Servia appears to be a chief danger spot, but it is profoundly to be hoped that the common-sense of its people - for even Servians must possess some of that quality - will prevent them from throwing their miserable little army against the well-trained legions of Austria.
In my decently-researched opinion, the sense of self-superiority among the governments and people of the Great Powers was the largest contributor to the breakout of the war. Each was certain that it was impossible for them to lose, and it was certainly impossible for a people as small and pitiful as the Serbs or Bulgars to have the agency to start a world war.
I'll leave you with a poem from a local paper in Pennsylvania, dated to March 1908 -
When news is dull beyond estimation,
When puny paragraphs begin to pall;
When everything is rank reiteration,
When nobody does anything at all;
When everybody looks in consternation,
At the columns where excitement isn’t there,
Then it’s time to help along the circulation
With the good old Balkan war cloud story scare.
Further reading -
Hall, Richard. “The Balkan Wars 1912-1913: Prelude to the First World War”. Routledge, 2000.
Vŭchkov, Aleksandŭr. “The Balkan War, 1912-1913”. Angela Sofia, 2005.