base <http://example.org/resource/>
prefix : <http://example.org/ontology/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
construct {
  ?person_customer_id_URL a :NaturalPerson;
    :id ?customer_id;
    :firstName ?first_name;
    :lastName ?last_name;
    :gender ?gender;
    :religion ?religion;
    :hasAddress ?person_customer_id_address_URL;
    :hasEvent ?person_customer_id_birth_URL;
    :hasEvent ?person_customer_id_education_URL.
  ?person_customer_id_address_URL a :Address;
    :houseNumber ?house_number;
    :street ?street;
    :postalCode ?postal_code;
    :city ?country_country_city_city_URLIFY_URL;
    :country ?country_country_URL.
  ?country_country_city_city_URLIFY_URL a :City; :country ?country_country_URL; :name ?city.
  ?country_country_URL a :Country; :code ?country.
  ?person_customer_id_birth_URL a :BirthEvent; :hasDate ?date_of_birth_xsd_date.
  ?person_customer_id_education_URL a :EducationEvent;
    :hasDate ?enrollment_date_xsd_date;
    :university ?university_university_URLIFY_URL;
    :degree ?degree_education_degree_URLIFY_URL.
}
where {
    bind(iri(concat("person/",?customer_id)) as ?person_customer_id_URL)
    bind(iri(concat("person/",?customer_id,"/address")) as ?person_customer_id_address_URL)
    bind(iri(concat("person/",?customer_id,"/birth")) as ?person_customer_id_birth_URL)
    bind(iri(concat("person/",?customer_id,"/education")) as ?person_customer_id_education_URL)
    bind(replace(replace(replace(?city, "[^\\p{L}0-9]", "_"), "_+", "_"), "^_|_$", "") as ?city_URLIFY)
    bind(iri(concat("country/",?country,"/city/",?city_URLIFY)) as ?country_country_city_city_URLIFY_URL)
    bind(iri(concat("country/",?country)) as ?country_country_URL)
    bind(strdt(?date_of_birth,xsd:date) as ?date_of_birth_xsd_date)
    bind(strdt(?enrollment_date,xsd:date) as ?enrollment_date_xsd_date)
    bind(replace(replace(replace(?university, "[^\\p{L}0-9]", "_"), "_+", "_"), "^_|_$", "") as ?university_URLIFY)
    bind(iri(concat("university/",?university_URLIFY)) as ?university_university_URLIFY_URL)
    bind(replace(replace(replace(?education_degree, "[^\\p{L}0-9]", "_"), "_+", "_"), "^_|_$", "") as ?education_degree_URLIFY)
    bind(iri(concat("degree/",?education_degree_URLIFY)) as ?degree_education_degree_URLIFY_URL)
}
