If you're just trying to extract all the subjects and objects of the owns and published triples, then this can be a very simple query. If, on the other hand, you only want data where there's all three parts, you'll need a full union. Let's create some example data and see what we can do:
@prefix : <urn:ex:>
:a :owns :b .
:b :publishes 1 .
:c :owns :d .
:d :publishes 2 .
:e :owns :f . # no corresponding :publishes
:g :publishes :h . # no corresponding :ownsprefix : <urn:ex:>
Here's your current query and results:
select ?x ?y ?z {
?x :owns ?y .
?y :publishes ?z .
}
---------------
| x | y | z |
===============
| :a | :b | 1 |
| :c | :d | 2 |
---------------
Now, if you're willing to get those owns and publishes triples that don't have corresponding publishes and owns triples, you can use a union, values block, or property path. The union would be
{ ?x :owns ?y } union { ?x :publishes ?y }
The values block would would be a bit simpler:
values ?p { :owns :publishes }
?x ?p ?y
You can make that even simpler with a property path:
?x :owns|:publishes ?y
These all give you:
-----------
| x | y |
===========
| :a | :b |
| :b | 1 |
| :c | :d |
| :d | 2 |
| :e | :f | * owns
| :g | :h | * publishes
-----------
Note that the rows with stars are present because "e owns f" and "g publishes h", even though there's nothing that f publishes, and nothing that owns g. Your original query won't find those. If you need to exclude the owns and publishes triples that don't have publishes and own counterparts, you'll need to use the union option, that includes all the parts as in user205512's answer.