old_contents: #!/usr/bin/env python3
  
  from intermine.webservice import Service
  service = Service("http://human.intermine.org/human/service")
  
  # Get a new query on the class (table) you will be querying:
  query = service.new_query("Gene")
  
  # The view specifies the output columns
  query.add_view("primaryIdentifier")
  
  # Uncomment and edit the line below (the default) to select a custom sort order:
  # query.add_sort_order("Pathway.primaryIdentifier", "ASC")
  
  # You can edit the constraint values below
  # query.add_constraint("primaryIdentifier", "IS NOT NULL", code = "A")
  query.add_constraint("primaryIdentifier", "IS NOT NULL", code="A")
  # query.add_constraint("organism.shortName", "=", "H. sapiens", code = "B")
  
  # Uncomment and edit the code below to specify your own custom logic:
  # query.set_logic("A")
  
  sitemapCount = 0
  
  prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  prefix += "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n"
  prefix += "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
  prefix += "  xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9" \
      + " http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n"
  
  postfix = "</urlset>"
  
  rowCount = 0
  
  f = open('sitemap' + str(sitemapCount) + '.xml', 'w')
  
  f.write(prefix)
  
  for row in query.rows():
      f.write(
          "<url><loc>http://www.humanmine.org/human/portal.do?class=Gene&amp;externalids="
          + row["primaryIdentifier"] + "</loc></url>\n")
      rowCount = rowCount + 1
      if rowCount >= 50000:
          f.write(postfix)
          f.close()
          sitemapCount = sitemapCount + 1
          f = open('sitemap' + str(sitemapCount) + '.xml', 'w')
          f.write(prefix)
          rowCount = 1
  
  f.write(postfix)
  f.close() 
  
new_contents: #!/usr/bin/env python3
  
  import jargparse
  from intermine.webservice import Service
  
  ############
  ### MAIN ###
  ############
  parser = jargparse.ArgParser('Generate a sitemap for an InterMine installation.')
  parser.add_argument(
      'mineServiceUrl', help = "InterMine webservices URL.  For example, http://synbiomine.org/synbiomine/service")
  args = parser.parse_args()
  
  service = Service(args.mineServiceUrl)
  
  # Get a new query on the class (table) you will be querying:
  query = service.new_query("Gene")
  
  # The view specifies the output columns
  query.add_view("primaryIdentifier")
  
  # Uncomment and edit the line below (the default) to select a custom sort order:
  # query.add_sort_order("Pathway.primaryIdentifier", "ASC")
  
  # You can edit the constraint values below
  # query.add_constraint("primaryIdentifier", "IS NOT NULL", code = "A")
  query.add_constraint("primaryIdentifier", "IS NOT NULL", code="A")
  # query.add_constraint("organism.shortName", "=", "H. sapiens", code = "B")
  
  # Uncomment and edit the code below to specify your own custom logic:
  # query.set_logic("A")
  
  sitemapCount = 0
  
  prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  prefix += "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n"
  prefix += "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
  prefix += "  xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9" \
      + " http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n"
  
  postfix = "</urlset>"
  
  rowCount = 0
  
  f = open('sitemap' + str(sitemapCount) + '.xml', 'w')
  
  f.write(prefix)
  
  for row in query.rows():
      f.write(
          "<url><loc>http://www.humanmine.org/human/portal.do?class=Gene&amp;externalids="
          + row["primaryIdentifier"] + "</loc></url>\n")
      rowCount = rowCount + 1
      if rowCount >= 50000:
          f.write(postfix)
          f.close()
          sitemapCount = sitemapCount + 1
          f = open('sitemap' + str(sitemapCount) + '.xml', 'w')
          f.write(prefix)
          rowCount = 1
  
  f.write(postfix)
  f.close() 
  
subject: allow generateSitemap.py to accept any mine service url as an argument, not hardcoded to humanmine