Get science metadata for a resource in XML+RDF format

        :param pid: The HydroShare ID of the resource
        :raises: HydroShareNotAuthorized if the user is not authorized to view the metadata.
        :raises: HydroShareNotFound if the resource was not found.
        :raises: HydroShareHTTPException to signal an HTTP error.
        :return: A string representing the XML+RDF serialization of science metadata.
        Example of data XML+RDF returned:

        <?xml version="1.0"?>
        <!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN"
        "http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd">
        <rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:hsterms="http://hydroshare.org/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs1="http://www.w3.org/2001/01/rdf-schema#">
          <rdf:Description rdf:about="http://www.hydroshare.org/resource/87ffb608900e407ab4b67d30c93b329e">
            <dc:title>Great Salt Lake Level and Volume</dc:title>
            <dc:type rdf:resource="http://www.hydroshare.org/terms/GenericResource"/>
            <dc:description>
              <rdf:Description>
                <dcterms:abstract>Time series of level, area and volume in the Great Salt Lake. Volume and area of the Great Salt Lake are derived from recorded levels</dcterms:abstract>
              </rdf:Description>
            </dc:description>
            <hsterms:awardInfo>
              <rdf:Description rdf:about="http://www.nsf.gov">
                <hsterms:fundingAgencyName>National Science Foundation</hsterms:fundingAgencyName>
                <hsterms:awardTitle>Model Execution Cyberinfrastructure </hsterms:awardTitle>
                <hsterms:awardNumber>NSF_9087658_2017</hsterms:awardNumber>
              </rdf:Description>
            </hsterms:awardInfo>
            <dc:creator>
              <rdf:Description>
                <hsterms:name>John Smith</hsterms:name>
                <hsterms:creatorOrder>1</hsterms:creatorOrder>
                <hsterms:organization>Utah State University</hsterms:organization>
                <hsterms:email>john.smith@gmail.com</hsterms:email>
                <hsterms:address>Engineering Building, USU, Logan, Utah</hsterms:address>
                <hsterms:phone rdf:resource="tel:435-797-8967"/>
              </rdf:Description>
            </dc:creator>
            <dc:creator>
              <rdf:Description>
                <hsterms:name>Lisa Miller</hsterms:name>
                <hsterms:creatorOrder>2</hsterms:creatorOrder>
              </rdf:Description>
            </dc:creator>
            <dc:contributor>
              <rdf:Description>
                <hsterms:name>Jenny Parker</hsterms:name>
                <hsterms:organization>Univesity of Utah</hsterms:organization>
                <hsterms:email>jenny_parker@hotmail.com</hsterms:email>
              </rdf:Description>
            </dc:contributor>
            <dc:coverage>
              <dcterms:period>
                <rdf:value>start=2000-01-01T00:00:00; end=2010-12-12T00:00:00; scheme=W3C-DTF</rdf:value>
              </dcterms:period>
            </dc:coverage>
            <dc:date>
              <dcterms:created>
                <rdf:value>2017-01-03T17:06:18.932217+00:00</rdf:value>
              </dcterms:created>
            </dc:date>
            <dc:date>
              <dcterms:modified>
                <rdf:value>2017-01-03T17:35:34.067279+00:00</rdf:value>
              </dcterms:modified>
            </dc:date>
            <dc:format>image/tiff</dc:format>
            <dc:identifier>
              <rdf:Description>
                <hsterms:hydroShareIdentifier>http://www.hydroshare.org/resource/87ffb608900e407ab4b67d30c93b329e</hsterms:hydroShareIdentifier>
              </rdf:Description>
            </dc:identifier>
            <dc:language>eng</dc:language>
            <dc:rights>
              <rdf:Description>
                <hsterms:rightsStatement>This resource is shared under the Creative Commons Attribution CC BY.</hsterms:rightsStatement>
                <hsterms:URL rdf:resource="http://creativecommons.org/licenses/by/4.0/"/>
              </rdf:Description>
            </dc:rights>
            <dc:subject>NSF</dc:subject>
            <dc:subject>Model</dc:subject>
            <dc:subject>Cyberinfrastructure</dc:subject>
            <hsterms:extendedMetadata>
              <rdf:Description>
                <hsterms:key>model</hsterms:key>
                <hsterms:value>ueb</hsterms:value>
              </rdf:Description>
            </hsterms:extendedMetadata>
            <hsterms:extendedMetadata>
              <rdf:Description>
                <hsterms:key>os</hsterms:key>
                <hsterms:value>windows</hsterms:value>
              </rdf:Description>
            </hsterms:extendedMetadata>
          </rdf:Description>
          <rdf:Description rdf:about="http://www.hydroshare.org/terms/GenericResource">
            <rdfs1:label>Generic</rdfs1:label>
            <rdfs1:isDefinedBy>http://www.hydroshare.org/terms</rdfs1:isDefinedBy>
          </rdf:Description>
        </rdf:RDF>

def getScienceMetadataRDF(self, pid):
        """ Get science metadata for a resource in XML+RDF format

        :param pid: The HydroShare ID of the resource
        :raises: HydroShareNotAuthorized if the user is not authorized to view the metadata.
        :raises: HydroShareNotFound if the resource was not found.
        :raises: HydroShareHTTPException to signal an HTTP error.
        :return: A string representing the XML+RDF serialization of science metadata.
        Example of data XML+RDF returned:

        <?xml version="1.0"?>
        <!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN"
        "http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd">
        <rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:hsterms="http://hydroshare.org/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs1="http://www.w3.org/2001/01/rdf-schema#">
          <rdf:Description rdf:about="http://www.hydroshare.org/resource/87ffb608900e407ab4b67d30c93b329e">
            <dc:title>Great Salt Lake Level and Volume</dc:title>
            <dc:type rdf:resource="http://www.hydroshare.org/terms/GenericResource"/>
            <dc:description>
              <rdf:Description>
                <dcterms:abstract>Time series of level, area and volume in the Great Salt Lake. Volume and area of the Great Salt Lake are derived from recorded levels</dcterms:abstract>
              </rdf:Description>
            </dc:description>
            <hsterms:awardInfo>
              <rdf:Description rdf:about="http://www.nsf.gov">
                <hsterms:fundingAgencyName>National Science Foundation</hsterms:fundingAgencyName>
                <hsterms:awardTitle>Model Execution Cyberinfrastructure </hsterms:awardTitle>
                <hsterms:awardNumber>NSF_9087658_2017</hsterms:awardNumber>
              </rdf:Description>
            </hsterms:awardInfo>
            <dc:creator>
              <rdf:Description>
                <hsterms:name>John Smith</hsterms:name>
                <hsterms:creatorOrder>1</hsterms:creatorOrder>
                <hsterms:organization>Utah State University</hsterms:organization>
                <hsterms:email>john.smith@gmail.com</hsterms:email>
                <hsterms:address>Engineering Building, USU, Logan, Utah</hsterms:address>
                <hsterms:phone rdf:resource="tel:435-797-8967"/>
              </rdf:Description>
            </dc:creator>
            <dc:creator>
              <rdf:Description>
                <hsterms:name>Lisa Miller</hsterms:name>
                <hsterms:creatorOrder>2</hsterms:creatorOrder>
              </rdf:Description>
            </dc:creator>
            <dc:contributor>
              <rdf:Description>
                <hsterms:name>Jenny Parker</hsterms:name>
                <hsterms:organization>Univesity of Utah</hsterms:organization>
                <hsterms:email>jenny_parker@hotmail.com</hsterms:email>
              </rdf:Description>
            </dc:contributor>
            <dc:coverage>
              <dcterms:period>
                <rdf:value>start=2000-01-01T00:00:00; end=2010-12-12T00:00:00; scheme=W3C-DTF</rdf:value>
              </dcterms:period>
            </dc:coverage>
            <dc:date>
              <dcterms:created>
                <rdf:value>2017-01-03T17:06:18.932217+00:00</rdf:value>
              </dcterms:created>
            </dc:date>
            <dc:date>
              <dcterms:modified>
                <rdf:value>2017-01-03T17:35:34.067279+00:00</rdf:value>
              </dcterms:modified>
            </dc:date>
            <dc:format>image/tiff</dc:format>
            <dc:identifier>
              <rdf:Description>
                <hsterms:hydroShareIdentifier>http://www.hydroshare.org/resource/87ffb608900e407ab4b67d30c93b329e</hsterms:hydroShareIdentifier>
              </rdf:Description>
            </dc:identifier>
            <dc:language>eng</dc:language>
            <dc:rights>
              <rdf:Description>
                <hsterms:rightsStatement>This resource is shared under the Creative Commons Attribution CC BY.</hsterms:rightsStatement>
                <hsterms:URL rdf:resource="http://creativecommons.org/licenses/by/4.0/"/>
              </rdf:Description>
            </dc:rights>
            <dc:subject>NSF</dc:subject>
            <dc:subject>Model</dc:subject>
            <dc:subject>Cyberinfrastructure</dc:subject>
            <hsterms:extendedMetadata>
              <rdf:Description>
                <hsterms:key>model</hsterms:key>
                <hsterms:value>ueb</hsterms:value>
              </rdf:Description>
            </hsterms:extendedMetadata>
            <hsterms:extendedMetadata>
              <rdf:Description>
                <hsterms:key>os</hsterms:key>
                <hsterms:value>windows</hsterms:value>
              </rdf:Description>
            </hsterms:extendedMetadata>
          </rdf:Description>
          <rdf:Description rdf:about="http://www.hydroshare.org/terms/GenericResource">
            <rdfs1:label>Generic</rdfs1:label>
            <rdfs1:isDefinedBy>http://www.hydroshare.org/terms</rdfs1:isDefinedBy>
          </rdf:Description>
        </rdf:RDF>
        """

        url = "{url_base}/scimeta/{pid}/".format(url_base=self.url_base, pid=pid)
        r = self._request('GET', url)
        if r.status_code != 200:
            if r.status_code == 403:
                raise HydroShareNotAuthorized(('GET', url))
            elif r.status_code == 404:
                raise HydroShareNotFound((pid,))
            else:
                raise HydroShareHTTPException((url, 'GET', r.status_code))

        return str(r.content)