예제 #1
0
def test_render_alternates_view_rdf():
    views3 = {
        'auorg':
        View(
            'AU Org View',
            'A view of basic properties of main classes in the AU Org Ontology',
            ['text/html'] + Renderer.RDF_MIMETYPES,
            'text/turtle',
            namespace='http://test.linked.data.gov.au/def/auorg#'),
        'test':
        View('Test View',
             'A view for testing', ['text/xml'],
             'text/xml',
             namespace='http://test.com'),
        'test2':
        View('Test2 View',
             'A second view for testing',
             Renderer.RDF_MIMETYPES,
             'application/rdf+xml',
             namespace='http://test2.com')
    }

    mr3 = MockRequest()
    mr3.url = 'http://whocares.com'
    mr3.values = {'_format': 'text/turtle'}
    mr3.headers = {}

    global r3
    r3 = MockRenderer(
        mr3,
        'http://whocares.com',
        views3,
        'test2'  # default view
    )
    print(r3._render_alternates_view_rdf().decode('utf-8'))
예제 #2
0
    def __init__(self, request, uri):
        views = {
            'gz':
            View(
                'Gazetteer View',
                'This view is the standard view delivered by the Place Names dataset in accordance with the '
                'Place Names Profile',
                ['text/html', 'text/turtle', 'application/ld+json'],
                'text/html')
        }

        super(Gazetteer, self).__init__(request, uri, views, 'gz', None)
        self.id = uri.split('/')[-1]

        self.hasName = {
            'uri': 'http://linked.data.gov.au/def/placenames/hasName',
            'label': 'has name',
            'comment': 'The Entity has a name (label) which is a text sting.',
            'value': None
        }
        # setup a dictionary of gazetteers
        #need to insert uri_id's to point to the authority though the naming authorities dictionary below
        self.register = {'label': None, 'uri': None}

        self.wasNamedBy = {'label': None, 'uri': None}

        self.hasNameFormality = {
            'label':
            'Official',
            'uri':
            'http://linked.data.gov.au/def/placenames/nameFormality/Official'
        }

        self.modifiedDate = None

        self.hasPronunciation = 'abcABCabc'

        self.hasName['value'] = str(GAZETTEERS[self.id]['label'])
        self.register['label'] = str(GAZETTEERS[self.id]['label'])
        #self.register['uri'] = GAZETTEER_URI_PREFIX + str(GAZETTEERS[self.id]['uri_id'])
        self.register['uri'] = str(GAZETTEERS[self.id]['uri_id'])
        self.modifiedDate = DATE_MODIFIED

        # need to build this naming Authorities dictionary out
        naming_authorities = {
            'ACT': {
                'label': 'Australian Capital Territory',
                'uri_id': 'act'
            },
            'AAD': {
                'label': 'Australian Antarctic Division',
                'uri_id': 'aad'
            },
            'WA': {
                'label': 'Western Australian Government',
                'uri_id': 'wa'
            }  # add the uri to the naming Authority
        }  # add all states, territories and other naming bodies
 def __init__(self, request, uri):
     views = {
         'mt':
         View('Mediatype View',
              'Basic properties of a Media Type, as recorded by IANA',
              ['text/html'] + Renderer.RDF_MIMETYPES,
              'text/turtle',
              languages=['en', 'pl'],
              namespace='http://test.linked.data.gov.au/def/mt#')
     }
     super().__init__(request, uri, views, 'mt')
예제 #4
0
 def _add_views(self):
     return {
         'skos':
         View(
             'Simple Knowledge Organization System (SKOS)',
             'SKOS is a W3C recommendation designed for representation of thesauri, classification schemes, '
             'taxonomies, subject-heading systems, or any other type of structured controlled vocabulary.',
             ['text/html', 'application/json'] + self.RDF_MIMETYPES,
             'text/html',
             languages=['en'],  # default 'en' only for now
             namespace='http://www.w3.org/2004/02/skos/core#')
     }
예제 #5
0
 def _add_skos_view(self):
     return {
         'skos':
         View(
             'Simple Knowledge Organization System (SKOS)',
             'SKOS provides a standard way to represent knowledge organization systems using the Resource Description Framework (RDF). '
             'Encoding this information in RDF allows it to be passed between computer applications in an interoperable way.',
             ['text/html', 'application/json'] + self.RDF_MIMETYPES,
             'text/html',
             languages=['en'],  # default 'en' only for now
             namespace='http://www.w3.org/2004/02/skos/core#')
     }
예제 #6
0
 def _add_dcat_view(self):
     return {
         'dcat':
         View(
             'Dataset Catalogue Vocabulary (DCAT)',
             'DCAT is an RDF vocabulary designed to facilitate interoperability between data catalogs published on '
             'the Web.',
             ['text/html', 'application/json'] + self.RDF_MIMETYPES,
             'text/html',
             languages=['en'],  # default 'en' only for now
             namespace='http://www.w3.org/ns/dcat#')
     }
예제 #7
0
    def __init__(self, request, xml=None):
        views = {
            "pdm": View(
                "GA's Public Data Model View",
                "Geoscience Australia's Public Data Model ontology",
                ["text/html", "text/turtle", "application/rdf+xml", "application/ld+json"],
                'text/html',
                profile_uri='http://pid.geoscience.gov.au/def/ont/ga/pdm'
            ),

            "nemsr": View(
                "The National Environmental Monitoring Sites Register View",
                "The National Environmental Monitoring Sites Register",
                ["application/vnd.geo+json"],
                "application/vnd.geo+json",
                profile_uri="http://www.neii.gov.au/nemsr"
            )
        }

        self.site_no = request.base_url.split('/')[-1]

        super(SiteRenderer, self).__init__(request, config.URI_SITE_INSTANCE_BASE + self.site_no, views, 'pdm')

        self.site_type = None
        self.description = None
        self.status = None
        self.entry_date = None
        self.geometry_type = None
        self.centroid_x = None
        self.centroid_y = None
        self.coords = None
        self.not_found = False

        if xml is not None:  # even if there are values for Oracle API URI and IGSN, load from XML file if present
            self._populate_from_xml_file(xml)
        else:
            self._populate_from_oracle_api()
예제 #8
0
    def __init__(self,
                 request,
                 navs,
                 items,
                 register_item_type_string,
                 total,
                 search_enabled=None,
                 search_query=None,
                 contained_item_classes=[],
                 **kwargs):
        self.navs = navs
        self.items = items
        self.register_item_type_string = register_item_type_string
        self.search_query = search_query
        self.search_enabled = search_enabled
        self.vocabulary_url = contained_item_classes
        self.template_extras = kwargs
        views = {
            'ckan':
            View(
                'Comprehensive Knowledge Archive Network',
                'The Comprehensive Knowledge Archive Network (CKAN) is a web-based open-source management system for '
                'the storage and distribution of open data.',
                ['application/json'],
                'application/json',
                languages=['en'],
                namespace='https://ckan.org/')
        }

        super().__init__(request,
                         request.base_url,
                         "Test Label",
                         "Test Comment",
                         items,
                         contained_item_classes,
                         total,
                         views=views)
예제 #9
0
dogs = [
    {
        "name": "Rex",
        "breed": "Dachshund",
        "age": 7,
        "color": "brown",
    }, {
        "name": "Micky",
        "breed": "Alsatian",
        "age": 3,
        "color": "black",
    }
]

MyPetView = View("PetView", "A profile of my pet.", ['text/html', 'application/json'],
                 'text/html', namespace="http://example.org/def/mypetview")

app = Flask(__name__)


class PetRenderer(Renderer):
    def __init__(self, request, uri, instance, pet_html_template, **kwargs):
        self.views = {'mypetview': MyPetView}
        self.default_view_token = 'mypetview'
        super(PetRenderer, self).__init__(
            request, uri, self.views, self.default_view_token, **kwargs)
        self.instance = instance
        self.pet_html_template = pet_html_template

    def _render_mypetview(self):
        if self.format == "application/json":
예제 #10
0
    def __init__(self, request, uri):
        views = {
            'pn': View(
                'Place Names View',
                'This view is the standard view delivered by the Place Names dataset in accordance with the '
                'Place Names Profile',
                ['text/html', 'text/turtle', 'application/ld+json'],
                'text/html'
            )
        }

        super(Placename, self).__init__(request, uri, views, 'pn', None)

        self.id = uri.split('/')[-1]

        self.hasName = {
            'uri': 'http://linked.data.gov.au/def/placenames/',
            'label': 'from National Composite Gazetteer of Australia (beta version 0.2):',
            'comment': 'The Entity has a name (label) which is a text sting.',
            'value': None
        }

        self.register = {
            'label': None,
            'uri': None
        }

        self.featureType = {
            'label': None,
            'uri': None
        }

        self.hasCategory = {
            'label': None,
            'uri': None
        }

        self.hasGroup = {
            'label': None,
            'uri': None
        }


        self.wasNamedBy = {
            'label': None,
            'uri': None
        }

        self.hasNameFormality = {
            'label': 'Official',
            'uri': 'http://linked.data.gov.au/def/placenames/nameFormality/Official'
        }

        self.authority = {
            'label': None,
            'web': None
        }
        self.email = None

        self.modifiedDate = None

        self.hasPronunciation = None   # None == don't display
        # pronunciation will only be displyed on webpage if it exists

        q = '''
            SELECT 
              	"NAME",
                "AUTHORITY",
                "SUPPLY_DATE", 
                "FEATURE",
                "CATEGORY",
                "GROUP",
                "LATITUDE",
                "LONGITUDE"
            FROM "PLACENAMES"
            WHERE "ID" = '{}'
        '''.format(self.id)
        for placename in conf.db_select(q):
            # for item in placename:
            #     print(item)
            #print(placename)
            #print(placename[0], placename[1], placename[2], placename[3], placename[4], placename[5]), placename[6], placename[7]
            # set up x y location from database
            self.y = placename[6]
            self.x = placename[7]

            self.hasName['value'] = str(placename[0]) + " (" + str(placename[3]).capitalize() + ")"

            self.featureType['label'] = str(placename[3])
            self.featureType['uri'] = 'http://vocabs.ands.org.au/repository/api/lda/ga/place-type/v1-0/resource?uri=http://pid.geoscience.gov.au/def/voc/ga/PlaceType/' + str(placename[3]).replace(' ','_')

            #self.hasCategory = str(placename[4])
            self.hasCategory['label'] = str(placename[4])
            self.hasCategory['uri'] = 'http://vocabs.ands.org.au/repository/api/lda/ga/place-type/v1-0/resource?uri=http://pid.geoscience.gov.au/def/voc/ga/PlaceType/' + str(placename[4]).replace(' ','_')

            #self.hasGroup = str(placename[5])
            self.hasGroup['label'] = str(placename[5])
            self.hasGroup['uri'] = 'http://vocabs.ands.org.au/repository/api/lda/ga/place-type/v1-0/resource?uri=http://pid.geoscience.gov.au/def/voc/ga/PlaceType/' + str(placename[5]).replace(' ','_')

            self.authority['label'] = (NAME_AUTHORITIES[str(placename[1])]['label'])
            self.authority['web'] = (NAME_AUTHORITIES[str(placename[1])]['web'])
            self.email = (NAME_AUTHORITIES[str(placename[1])]['email'])

            #print('authority', self.authority)

            self.register['uri'] = (GAZETTEERS[str(placename[1])]['uri_id'])
            self.register['label'] = (GAZETTEERS[str(placename[1])]['label'])

            #self.register['uri'] = 'http://linked.data.gov.au/dataset/placenames/gazetteer/' + str(placename[1])

            #print('name auth', naming_authorities[str(placename[1])]['label'])

            self.supplyDate = placename[2]
            #DGGS function
            resolution = 9
            # coords = (longi, lati)  # format required like this
            coords = (self.x, self.y)
            self.thisCell = rdggs.cell_from_point(resolution, coords, plane=False)  # false = on the elipsoidal curve
예제 #11
0
    def __init__(self, request, uri):
        views = {
            'pn':
            View(
                'Plane Names View',
                'This view is the standard view delivered by the Place Names dataset in accordance with the '
                'Place Names Profile',
                ['text/html', 'text/turtle', 'application/ld+json'],
                'text/html')
        }

        super(Placename, self).__init__(request, uri, views, 'pn', None)
        self.id = uri.split('/')[-1]

        self.hasName = {
            'uri': 'http://linked.data.gov.au/def/placename/hasName',
            'label': 'has name',
            'comment': 'The Entity has a name (label) which is a text sting.',
            'value': None
        }

        gazetteers = {
            'AAD': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'ACT': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'AHO': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'NSW': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'NT': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'QLD': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'SA': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'TAS': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'VIC': {
                'label': 'Australian Antarctica Gazetteer',
                'uri_id': 'aag'
            },
            'WA': {
                'label': 'Western Australia\'s Place Names Gazetteer',
                'uri_id': 'wa'
            }
        }

        self.register = {'label': None, 'uri': None}

        self.wasNamedBy = {'label': None, 'uri': None}

        self.hasNameFormality = {
            'label':
            'Official',
            'uri':
            'http://linked.data.gov.au/def/placenames/nameFormality/Official'
        }

        self.modifiedDate = None

        self.hasPronunciation = 'abcABCabc'

        q = '''
            SELECT 
              	"NAME",
                "AUTHORITY",
                "SUPPLY_DATE"
            FROM "PLACENAMES"
            WHERE "ID" = '{}'
        '''.format(self.id)
        for placename in conf.db_select(q):
            self.hasName['value'] = str(placename[0])
            self.register['label'] = str(placename[1])
            self.register[
                'uri'] = 'http://linked.data.gov.au/dataset/placenames/gazetteer/' + str(
                    placename[1])
            self.modifiedDate = placename[2]

        naming_authorities = {
            'ACT': {
                'label': 'Australian Capital Territory',
                'uri_id': 'act'
            },
            'AAD': {
                'label': 'Australian Antarctic Division',
                'uri_id': 'aad'
            },
            'WA': {
                'label': 'Western Australian Government',
                'uri_id': 'wa'
            }
        }
예제 #12
0
def accept_profile_testing_setup():
    # this tests Accept-Profile selection of 'test' view
    mr = MockRequest()
    mr.url = 'http://whocares.com'
    mr.values = {}
    mr.headers = {
        'Accept-Profile':
        'http://nothing.com ,'
        'http://nothing-else.com,'
        '<http://notavailable.com>; q=0.9, '  # ignored - not available
        '<http://test.linked.data.gov.au/def/auorg#>; q=0.1, '  # available but lower weight
        '<http://test.com>; q=0.2',
        'Accept':
        'text/turtle'
    }

    views = {
        'auorg':
        View(
            'AU Org View',
            'A view of basic properties of main classes in the AU Org Ontology',
            ['text/html'] + Renderer.RDF_MIMETYPES,
            'text/turtle',
            namespace='http://test.linked.data.gov.au/def/auorg#'),
        'test':
        View('Test View',
             'A view for testing', ['text/xml'],
             'text/xml',
             namespace='http://test.com')
    }

    global r
    r = MockRenderer(mr, 'http://whocares.com', views, 'auorg')

    # this tests QSA selection of 'alternates' view
    mr2 = MockRequest()
    mr2.url = 'http://whocares.com'
    mr2.values = {'_view': 'alternates'}
    mr2.headers = {}

    views2 = {
        'auorg':
        View(
            'AU Org View',
            'A view of basic properties of main classes in the AU Org Ontology',
            ['text/html'] + Renderer.RDF_MIMETYPES,
            'text/turtle',
            namespace='http://test.linked.data.gov.au/def/auorg#'),
        'test':
        View('Test View',
             'A view for testing', ['text/xml'],
             'text/xml',
             namespace='http://test.com')
    }

    global r2
    r2 = MockRenderer(mr2, 'http://whocares.com', views2, 'auorg')

    # this tests QSA selection of 'alternates' view
    mr3 = MockRequest()
    mr3.url = 'http://whocares.com'
    mr3.values = {}
    mr3.headers = {}

    views3 = {
        'auorg':
        View(
            'AU Org View',
            'A view of basic properties of main classes in the AU Org Ontology',
            ['text/html'] + Renderer.RDF_MIMETYPES,
            'text/turtle',
            namespace='http://test.linked.data.gov.au/def/auorg#'),
        'test':
        View('Test View',
             'A view for testing', ['text/xml'],
             'text/xml',
             namespace='http://test.com')
    }

    global r3
    r3 = MockRenderer(mr3, 'http://whocares.com', views3, 'auorg')
예제 #13
0
    def __init__(self, request, xml=None):
        views = {
            "gapd":
            View('GA Public Data View',
                 "Geoscience Australia's Public Data Model", [
                     'text/html', 'text/turtle', 'application/rdf+xml',
                     'application/rdf+json', 'application/json'
                 ],
                 'text/html',
                 namespace=None),
            "argus":
            View(
                'The Airborne Reductions Group Utility System View',
                "Geoscience Australia's Airborne Reductions Group Utility System (ARGUS)",
                ["text/xml"],
                'text/xml',
                namespace=None),
            'sosa':
            View(
                'SOSA View',
                "The W3C's Sensor, Observation, Sample, and Actuator ontology within the Semantic Sensor Networks ontology",
                ["text/turtle", "application/rdf+xml", "application/rdf+json"],
                "text/turtle",
                namespace="http://www.w3.org/ns/sosa/"),
            'prov':
            View('PROV View',
                 "The W3C's provenance data model, PROV", [
                     "text/html", "text/turtle", "application/rdf+xml",
                     "application/rdf+json"
                 ],
                 "text/turtle",
                 namespace="http://www.w3.org/ns/prov/")
        }

        self.survey_no = request.base_url.split('/')[-1]

        super(SurveyRenderer,
              self).__init__(request,
                             config.URI_SURVEY_INSTANCE_BASE + self.survey_no,
                             views, "gapd")

        self.survey_name = None
        self.state = None
        self.operator = None
        self.contractor = None
        self.processor = None
        self.survey_type = None
        self.data_types = None
        self.vessel = None
        self.vessel_type = None
        self.release_date = None
        self.onshore_offshore = None
        self.start_date = None
        self.end_date = None
        self.w_long = None
        self.e_long = None
        self.s_lat = None
        self.n_lat = None
        self.line_km = None
        self.total_km = None
        self.line_spacing = None
        self.line_direction = None
        self.tie_spacing = None
        self.square_km = None
        self.crystal_volume = None
        self.up_crystal_volume = None
        self.digital_data = None
        self.geodetic_datum = None
        self.asl = None
        self.agl = None
        self.mag_instrument = None
        self.rad_instrument = None

        self.srid = 8311  # TODO: replace this magic number with a value from the DB

        # populate all instance variables from API
        # TODO: lazy load this, i.e. only populate if a controller that need populating is loaded which is every controller except for Alternates
        if xml is not None:  # even if there are values for Oracle API URI and IGSN, load from XML file if present
            self._populate_from_xml_file(xml)
        else:
            self._populate_from_oracle_api()

        # these coordinate things can only be calculated after populating variables from XML file / XML API
        self.wkt_polygon = self._generate_wkt()

        self.centroid_lat = (self.n_lat + self.s_lat) / 2
        self.centroid_lon = (self.e_long + self.w_long) / 2

        # clean-up required vars
        if self.end_date is None:
            self.end_date = datetime(1900, 1, 1)
from pyldapi import Renderer, View
from rdflib import Graph, URIRef, RDF, RDFS, XSD, OWL, Namespace, Literal, BNode
from rdflib.namespace import NamespaceManager
import _config as config
import json
from shapely.geometry import shape
from pprint import pprint
import psycopg2
import os
from .mappings import DatasetMappings

dataset_mappings = DatasetMappings()

GeometryView = View(
    "GeometryView",
    "A profile of geometry.",
    ['text/html', 'application/json', 'text/turtle', 'text/plain'],
    'text/html',
    namespace="http://example.org/def/geometryview")

CentroidView = View(
    "CentroidView",
    "A profile of geometry's centroid.",
    ['text/html', 'application/json', 'text/turtle', 'text/plain'],
    'text/html',
    namespace="http://example.org/def/centroidview")

SimplifiedGeomView = View(
    "SimplifiedGeomView",
    "A profile of the geometry that has been simplified.",
    ['text/html', 'application/json', 'text/turtle', 'text/plain'],
    'text/html',
from flask import Response, render_template
from pyldapi import Renderer, View
from datetime import datetime
from io import StringIO
import requests
from rdflib import Graph, URIRef, RDF, RDFS, XSD, OWL, Namespace, Literal, BNode
import _config as config
import json

SearchResultsView = View("SearchResultsView",
                         "A profile of search results view.",
                         ['text/html', 'application/json'],
                         'text/html',
                         namespace="http://example.org/def/searchresultsview")


class SearchResultsRenderer(Renderer):
    def __init__(self, request, uri, instance, search_html_template, **kwargs):
        self.views = {'searchresultsview': SearchResultsView}
        self.default_view_token = 'searchresultsview'
        super(SearchResultsRenderer,
              self).__init__(request, uri, self.views, self.default_view_token,
                             **kwargs)
        self.instance = instance
        self.search_html_template = search_html_template

    def _render_searchresultsview(self):
        self.headers['Profile'] = 'http://example.org/def/searchresultsview'
        if self.format == "application/json":
            return Response(json.dumps(self.instance),
                            mimetype="application/json",
예제 #16
0
    def __init__(self, request, xml=None):
        views = {
            'csirov3': View(
                'CSIRO IGSN View',
                'An XML-only metadata schema for descriptive elements of IGSNs',
                ['text/xml'],
                'text/xml',
                namespace='https://confluence.csiro.au/display/AusIGSN/CSIRO+IGSN+IMPLEMENTATION'
            ),

            'dct': View(
                'DC Terms View',
                'Dublin Core Terms from the Dublin Core Metadata Initiative',
                [
                    "text/html",
                    "text/turtle",
                    "application/rdf+xml",
                    "application/rdf+json",
                    "application/xml",
                    "text/xml"
                ],
                'text/turtle',
                namespace='http://purl.org/dc/terms/'
            ),

            'igsn': View(
                'IGSN View',
                'The official IGSN XML schema',
                ['text/xml'],
                'text/xml',
                namespace='http://schema.igsn.org/description/'
            ),

            'igsn-r1': View(
                'IGSN v1. View',
                'Version 1 of the official IGSN XML schema',
                ['text/xml'],
                'text/xml',
                namespace='http://schema.igsn.org/description/1.0'
            ),

            'igsn-o': View(
                'IGSN Ontology View',
                "An OWL ontology of Samples based on CSIRO's XML-based IGSN schema",
                ["text/html", "text/turtle", "application/rdf+xml", "application/rdf+json"],
                'text/html',
                namespace='http://pid.geoscience.gov.au/def/ont/ga/igsn'
            ),

            'prov': View(
                'PROV View',
                "The W3C's provenance data model, PROV",
                ["text/html", "text/turtle", "application/rdf+xml", "application/rdf+json"],
                "text/turtle",
                namespace="http://www.w3.org/ns/prov/"
            ),

            'sosa': View(
                'SOSA View',
                "The W3C's Sensor, Observation, Sample, and Actuator ontology within the Semantic Sensor Networks ontology",
                ["text/turtle", "application/rdf+xml", "application/rdf+json"],
                "text/turtle",
                namespace="http://www.w3.org/ns/sosa/"
            ),
        }

        # this class only handles 2 cases of references to Samples:
        #
        #   1. PID URI, e.g. http://pid.geoscience.gov.au/sample/AU239
        #       - or Local URI, e.g. http://localhost:5000/sample/AU239
        #   2. OAI-PMH URL, e.g. http://pid.geoscience.gov.au/oai?verb=GetRecord&identifier=AU239&metadataPrefix=dc
        #       - or local URL, e.g. http://localhost:5000/oai?verb=GetRecord&identifier=AU239&metadataPrefix=dc
        if request.base_url.endswith('oai'):
            self.igsn = request.values['identifier']
        else:
            self.igsn = request.base_url.split('/')[-1]

        super(SampleRenderer, self).__init__(request, config.URI_SAMPLE_INSTANCE_BASE + self.igsn, views, 'igsn-o')

        self.sample_id = None
        self.access_rights = None
        self.sample_type = None
        self.method_type = None
        self.material_type = None
        self.long_min = None
        self.long_max = None
        self.lat_min = None
        self.lat_max = None
        self.gtype = None
        self.srid = None
        self.x = None
        self.y = None
        self.z = None
        self.elem_info = None
        self.ordinates = None
        self.state = None
        self.country = None
        self.depth_top = None
        self.depth_base = None
        self.strath = None
        self.age = None
        self.remark = None
        self.lith = None
        self.date_acquired = None
        self.entity_uri = None
        self.entity_name = None
        self.entity_type = None
        self.hole_long_min = None
        self.hole_long_max = None
        self.hole_lat_min = None
        self.hole_lat_max = None
        self.date_modified = None
        self.sample_no = None
        self.custodian_uri = self.URI_GA  # default
        self.custodian_label = 'Geoscience Australia'  # default
        self.collector = None
        self.not_found = False

        if xml is not None:  # even if there are values for Oracle API URI and IGSN, load from XML file if present
            self._populate_from_xml_file(xml)
        else:
            self._populate_from_oracle_api()
예제 #17
0
from flask import Response, render_template
from pyldapi import Renderer, View
from rdflib import Graph, URIRef, RDF, RDFS, XSD, OWL, Namespace, Literal, BNode
from rdflib.namespace import NamespaceManager
import _config as config
import json
from pprint import pprint
import os

DefaultView = View(
    "default",
    "Default dataset view",
    ['text/html', 'application/json', 'text/turtle', 'text/plain'],
    'text/html',
    namespace="http://example.org/def/datasetview")


class DatasetRenderer(Renderer):
    def __init__(self, request, uri, instance, dataset_html_template,
                 **kwargs):
        self.views = {'default': DefaultView}
        self.default_view_token = 'default'
        super(DatasetRenderer,
              self).__init__(request, uri, self.views, self.default_view_token,
                             **kwargs)
        self.instance = instance
        self.dataset_html_template = dataset_html_template
        self.uri = uri
        self.request = request

    def _render_dataset_default_view(self):