I'm working on my graduation thesis and my project consists on the extraction of knowledge from documents containing parsed comments about products or services, using ontologies to indicate the "characteristics" of these products or services, so each can be rated as positive or negative individually, instead of having a single rating for the whole review.
While I can, and if need be I will, tie to a single ontology and specialize my work, the main idea would be to create a framework out of it, so I'd receive the comments on a file and would have the ontology on another file, either OWL or RDF.

The problem with most libraries or frameworks I've seen is that they rely on code generation, while I'd need this to be dynamic, just change the file and read it.
From what I've seen, even SPARQL relies on knowing the ontology structure, so that's also a no-go for me, since I'd need to create queries specialized for each different ontology.

Is there already any library, either for .NET or Python (the languages I consider using for writing my code in) which allows me to work this way with ontologies, or is it up to me to write this? :)

RDFlib is probably the most mature library for working with RDF in python. I have used it for hobby projects, and for those needs (ie. somewhat limited), it has not failed me.

easy_install rdflib

to get the newest stable version.

In C#-land, I would go with SemWeb.NET (as also mentioned in the linked SO post in the comment to your question). I haven't used the library, but Joshua Tauberer, the author, is a pretty capable guy IMO.