prefix dcterms:
prefix dbr:
prefix dbp:
select ?showB ?subjScore ?starScore ?creatorScore ?execprodScore ((?subjScore + ?starScore + (?creatorScore * 0.5) + (?execprodScore * 0.75)) / 4 as ?integratedScore)
where {
{
select ?showB (strdt(?subjCountShowAB,xsd:double) / (?subjCountShowA + ?subjCountShowB - ?subjCountShowAB) as ?subjScore) (strdt(?starCountShowAB,xsd:double) / (?starCountShowA + ?starCountShowB - ?starCountShowAB) as ?starScore) (strdt(?creatorCountShowAB,xsd:double) / (?creatorCountShowA + ?creatorCountShowB - ?creatorCountShowAB) as ?creatorScore) (strdt(?execprodCountShowAB,xsd:double) / (?execprodCountShowA + ?execprodCountShowB - ?execprodCountShowAB) as ?execprodScore)
where {
{
select ?showB ?subjCountShowAB ?subjCountShowA (count(?subject) as ?subjCountShowB) ?starCountShowAB ?starCountShowA (count(distinct ?star) as ?starCountShowB) ?creatorCountShowAB ?creatorCountShowA (count(distinct ?creator) as ?creatorCountShowB) ?execprodCountShowAB ?execprodCountShowA (count(distinct ?execprod) as ?execprodCountShowB)
where {
{
?showB dcterms:subject ?subject
} union {
?showB dbp:starring ?star .
} union {
?showB dbp:creator ?creator .
} union {
?showB dbp:executiveProducer ?execprod .
}
{
select ?showB (count(?subject) as ?subjCountShowAB) ?subjCountShowA (count(distinct ?star) as ?starCountShowAB) ?starCountShowA (count(distinct ?creator) as ?creatorCountShowAB) ?creatorCountShowA (count(distinct ?execprod) as ?execprodCountShowAB) ?execprodCountShowA
where {
{
?showA dcterms:subject ?subject .
?showB dcterms:subject ?subject filter(!sameTerm(?showA,?showB)) .
} union {
?showA dbp:starring ?star .
?showB dbp:starring ?star filter(!sameTerm(?showA,?showB)) .
} union {
?showA dbp:creator ?creator .
?showB dbp:creator ?creator filter(!sameTerm(?showA,?showB)) .
?showB a dbo:TelevisionShow .
} union {
?showA dbp:executiveProducer ?execprod .
?showB dbp:executiveProducer ?execprod filter(!sameTerm(?showA,?showB)) .
?showB a dbo:TelevisionShow .
}
{
select ?showA (count(distinct ?subject) as ?subjCountShowA) (count(distinct ?star) as ?starCountShowA) (count(distinct ?creator) as ?creatorCountShowA) (count(distinct ?execprod) as ?execprodCountShowA)
where {
{ ?showA dcterms:subject ?subject filter(sameTerm(?showA,dbr:Friends)) }
union { ?showA dbp:starring ?star filter(sameTerm(?showA,dbr:Friends)) }
union { ?showA dbp:creator ?creator filter(sameTerm(?showA,dbr:Friends)) }
union { ?showA dbo:executiveProducer ?execprod filter(sameTerm(?showA,dbr:Friends)) }
}
}
} group by ?showB ?subjCountShowA ?starCountShowA ?creatorCountShowA ?execprodCountShowA
}
} group by ?showB ?subjCountShowAB ?subjCountShowA ?starCountShowAB ?starCountShowA ?creatorCountShowAB ?creatorCountShowA ?execprodCountShowAB ?execprodCountShowA
}
}
}
} order by desc(?integratedScore) limit 100