Did {Hamlet} {characters} {Gertrude} and {The Ghost} ?
Was it Hamlet that created the characters of Gertrude and The Ghost?
Did Hamlet create the characters Gertrude and The Ghost?
ASK WHERE { resource:Hamlet property:characters resource:The_Ghost . resource:Hamlet property:characters resource:Gertrude }
 ASK { ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q41567> . ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P674> . ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q546616>. ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q41567> . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P674> . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q1813659>. } 
ASK WHERE { wd:Q41567 wdt:P674 wd:Q546616 . wd:Q41567 wdt:P674 wd:Q1813659 }