test.url=https://knowledgestore2.fbk.eu/nwr/wikinews/
#test.username=NO_USERNAME_REQUIRED
#test.password=NO_PASSWORD_REQUIRED

test.mixes=1000000
test.queries=q1,q2,q3,q4,q5,q6,q7
test.out=parameters.tsv.gz

q1.file=events.tsv.gz
q1.query=\
  SELECT ?event ?event_year ?mention ?resource \
  WHERE { \
    { \
      SELECT ?event (MIN(?y) AS ?event_year) \
      WHERE { \
        ?event sem:hasTime ?t . \
        ?t owltime:inDateTime ?d . \
        ?d owltime:year ?y . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor , ?actor2 . \
          ?actor a dbo:Person . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
      GROUP BY ?event \
    } \
    { \
      SELECT ?event (SAMPLE(?m) AS ?mention) \
      WHERE { \
        ?event gaf:denotedBy ?m \
      } \
      GROUP BY ?event \
    } \
    BIND (IRI(STRBEFORE(STR(?mention), "#")) AS ?resource) \
  }

q2.file=event_types.tsv.gz
q2.query= \
  SELECT DISTINCT ?event ?event_type \
  WHERE { \
    { \
      SELECT DISTINCT ?event \
      WHERE { \
        ?event sem:hasActor ?actor . \
        ?actor a dbo:Person . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor2 . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
    } \
    ?event a ?event_type . \
    FILTER (?event_type != sem:Event) \
    FILTER NOT EXISTS { \
      ?event a ?event_type2 . \
      ?event_type2 rdfs:subClassOf ?event_type \
      FILTER (?event_type2 != ?event_type) \
    } \
  }

q3.file=event_terms.tsv.gz
q3.query=\
  SELECT DISTINCT ?event ?event_term \
  WHERE { \
    { \
      SELECT DISTINCT ?event \
      WHERE { \
        ?event sem:hasActor ?actor . \
        ?actor a dbo:Person . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor2 . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
    } \
    ?event rdfs:label ?l . \
    FILTER (REGEX(?l,"^[A-Za-z]+$")) \
    BIND (LCASE(REPLACE(?l, " .*", "")) AS ?event_term) \
    FILTER (STRLEN(?event_term) >= 3) \
  }

q4.file=event_actors.tsv.gz
q4.query=\
  SELECT DISTINCT ?event ?actor ?actor_related \
  WHERE { \
    ?event sem:hasActor ?actor , ?actor_related . \
    ?actor a dbo:Person . \
    ?actor_related a dbo:Person . \
    FILTER (?actor != ?actor_related) \
  }

q5.file=actor_types.tsv.gz
q5.query=\
  SELECT DISTINCT ?actor ?actor_type \
  WHERE { \
    { \
      SELECT DISTINCT ?actor \
      WHERE { \
        ?event sem:hasActor ?actor . \
        ?actor a dbo:Person . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor2 . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
    } \
    ?actor a ?actor_type \
    FILTER (?actor_type != dbo:Person) \
    FILTER (STRSTARTS(STR(?actor_type), "http://dbpedia.org/")) \
    FILTER NOT EXISTS { \
      ?actor a ?actor_type2 . \
      ?actor_type2 rdfs:subClassOf ?actor_type \
      FILTER (?actor_type2 != ?actor_type) \
    } \
  }

q6.file=actor_terms.tsv.gz
q6.query=\
  SELECT DISTINCT ?actor ?actor_term \
  WHERE { \
    { \
      SELECT DISTINCT ?actor \
      WHERE { \
        ?event sem:hasActor ?actor . \
        ?actor a dbo:Person . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor2 . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
    } \
    GRAPH ?g { ?actor rdfs:label ?l } \
    ?g dct:source <http://dbpedia.org/> . \
    FILTER (REGEX(?l,"^[A-Z][A-Za-z ]*$") && STRLEN(?l) < 30) \
    BIND (LCASE(REPLACE(?l, " .*", "")) AS ?actor_term) \
    FILTER (STRLEN(?actor_term) >= 3) \
  }

q7.file=actor_properties.tsv.gz
q7.query=\
  SELECT DISTINCT ?actor ?actor_property \
  WHERE { \
    { \
      SELECT DISTINCT ?actor \
      WHERE { \
        ?event sem:hasActor ?actor . \
        ?actor a dbo:Person . \
        FILTER EXISTS { \
          ?event sem:hasActor ?actor2 . \
          ?actor2 a dbo:Person . \
          FILTER (?actor != ?actor2) \
        } \
      } \
    } \
    ?actor ?actor_property ?value \
    FILTER (STRSTARTS(STR(?actor_property), "http://dbpedia.org/")) \
  }
