Refactored type inference to use Optional in GraphMLWriter.