<commit_before>/**
 * Created by fsuda on 18.09.2018.
 */
import { details, emptyDraft } from "../detail-definitions.js";
import { findLatestIntervallEndInJsonLdOrNowAndAddMillis } from "../../app/won-utils.js";
import won from "../../app/won-es6.js";
import { getIn, isValidDate } from "../../app/utils.js";
import {
  filterInVicinity,
  filterAboutTime,
  concatenateFilters,
  sparqlQuery,
} from "../../app/sparql-builder-utils.js";

const mobilityUseCases = {
  liftDemand: {
    identifier: "liftDemand",
    label: "Need a Lift",
    icon: "#ico36_uc_route_demand",
    doNotMatchAfter: findLatestIntervallEndInJsonLdOrNowAndAddMillis,
    draft: {
      ...emptyDraft,
      is: { title: "Need a lift", tags: "search-lift" },
      searchString: "offer-lift",
    },
    // TODO: amount of people? other details?
    isDetails: {
      title: { ...details.title },
      description: { ...details.description },
    },
    seeksDetails: {
      fromDatetime: { ...details.fromDatetime },
      travelAction: { ...details.travelAction },
    },
    generateQuery: (draft, resultName) => {
      const fromLocation = getIn(draft, [
        "seeks",
        "travelAction",
        "fromLocation",
      ]);
      const toLocation = getIn(draft, ["seeks", "travelAction", "toLocation"]);

      const baseFilter = {
        prefixes: {
          won: won.defaultContext["won"],
        },
        operations: [
          `${resultName} a won:Need.`,
          `${resultName} won:isInState won:Active. { ?is a <http://dbpedia.org/resource/Ridesharing>.  } union { ?is a s:TaxiService} }`,
          `${resultName} won:is ?is.`,
        ],
      };

      const locationFilter = filterInVicinity(
        "?location",
        fromLocation,
        /*radius=*/ 100
      );
      const fromLocationFilter = filterInVicinity(
        "?fromLocation",<commit_msg>Fix lift query<commit_after>/**
 * Created by fsuda on 18.09.2018.
 */
import { details, emptyDraft } from "../detail-definitions.js";
import { findLatestIntervallEndInJsonLdOrNowAndAddMillis } from "../../app/won-utils.js";
import won from "../../app/won-es6.js";
import { getIn, isValidDate } from "../../app/utils.js";
import {
  filterInVicinity,
  filterAboutTime,
  concatenateFilters,
  sparqlQuery,
} from "../../app/sparql-builder-utils.js";

const mobilityUseCases = {
  liftDemand: {
    identifier: "liftDemand",
    label: "Need a Lift",
    icon: "#ico36_uc_route_demand",
    doNotMatchAfter: findLatestIntervallEndInJsonLdOrNowAndAddMillis,
    draft: {
      ...emptyDraft,
      is: { title: "Need a lift", tags: "search-lift" },
      searchString: "offer-lift",
    },
    // TODO: amount of people? other details?
    isDetails: {
      title: { ...details.title },
      description: { ...details.description },
    },
    seeksDetails: {
      fromDatetime: { ...details.fromDatetime },
      travelAction: { ...details.travelAction },
    },
    generateQuery: (draft, resultName) => {
      const fromLocation = getIn(draft, [
        "seeks",
        "travelAction",
        "fromLocation",
      ]);
      const toLocation = getIn(draft, ["seeks", "travelAction", "toLocation"]);

      const baseFilter = {
        prefixes: {
          won: won.defaultContext["won"],
        },
        operations: [
          `${resultName} a won:Need.`,
          `${resultName} won:isInState won:Active. { { ?is a <http://dbpedia.org/resource/Ridesharing>.  } union { ?is a s:TaxiService} }`,
          `${resultName} won:is ?is.`,
        ],
      };

      const locationFilter = filterInVicinity(
        "?location",
        fromLocation,
        /*radius=*/ 100
      );
      const fromLocationFilter = filterInVicinity(
        "?fromLocation",
{'fraction_non_alphanumeric': 0.1562583757705709, 'fraction_numerical': 0.0075046904315197, 'mean_word_length': 2.50093808630394, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1090375', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1179, 'n_words': 239}