docs: def dataset_to_rdf(dataset, graph=None):
      '''
      Map a dataset domain model to a DCAT/RDF graph
      '''
      # Use the unlocalized permalink to the dataset as URI when available
      # unless there is already an upstream URI
      if 'uri' in dataset.extras:
          id = URIRef(dataset.extras['uri'])
      elif dataset.id:
          id = URIRef(url_for('datasets.show_redirect',
                              dataset=dataset.id,
                              _external=True))
      else:
          id = BNode()
      # Expose upstream identifier if present
      if 'dct:identifier' in dataset.extras:
          identifier = dataset.extras['dct:identifier']
      else:
          identifier = dataset.id
      graph = graph or Graph(namespace_manager=namespace_manager)
  
      d = graph.resource(id)
      d.set(RDF.type, DCAT.Dataset)
      d.set(DCT.identifier, Literal(identifier))
      d.set(DCT.title, Literal(dataset.title))
      d.set(DCT.description, Literal(dataset.description))
      d.set(DCT.issued, Literal(dataset.created_at))
      d.set(DCT.modified, Literal(dataset.last_modified))
  
      if dataset.acronym:
          d.set(SKOS.altLabel, Literal(dataset.acronym))
  
      for tag in dataset.tags:
          d.add(DCAT.keyword, Literal(tag))
  
      for resource in dataset.resources:
          d.add(DCAT.distribution, resource_to_rdf(resource, dataset, graph))
  
      if dataset.owner:
          d.add(DCT.publisher, user_to_rdf(dataset.owner, graph))
      elif dataset.organization:
          d.add(DCT.publisher, organization_to_rdf(dataset.organization, graph))
  
      if dataset.temporal_coverage:
          d.set(DCT.temporal, temporal_to_rdf(dataset.temporal_coverage, graph))
  
      frequency = frequency_to_rdf(dataset.frequency)
      if frequency:
          d.set(DCT.accrualPeriodicity, frequency)
  
      return d