PREFIX rdf: PREFIX rdfs: PREFIX foaf: PREFIX dc: PREFIX dcterms: SELECT ?yr ?name ?document WHERE { ?class rdfs:subClassOf foaf:Document . ?document rdf:type ?class . ?document dcterms:issued ?yr . ?document dc:creator ?author . ?author foaf:name ?name OPTIONAL { ?class2 rdfs:subClassOf foaf:Document . ?document2 rdf:type ?class2 . ?document2 dcterms:issued ?yr2 . ?document2 dc:creator ?author2 FILTER (?author=?author2 && ?yr2