How many {terminus location} are to/by {California} ?
California has how many terminus locations?
How many terminus locations are by California?
SELECT ( COUNT ( ?q ) AS ?a ) { ?q property:terminus_location resource:California }
SELECT (COUNT(?sub) AS ?subs ) {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?sub .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P609> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q99 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P609 wd:Q99 }
12