def map_pub(doi, meta, author_uri):
    g = Graph()

    author_uri = D[author_uri] #URIRef(author_uri)

    pub_local_name = hash_uri('pub' + doi + author_uri)
    publication_uri = D[pub_local_name]
    #pub metadata
    g.add( (publication_uri, RDF.type, BIBO.Document) )
    g.add( (publication_uri, RDFS.label, Literal(meta['title'])) )
    g.add( (publication_uri, BIBO.doi, Literal(doi)) )

    #authorhsip uri - create hash of these strings.
    local_name = hash_uri('aship' + doi + author_uri)
    authorship_uri = D[local_name]
    g.add( (authorship_uri, RDF.type, VIVO.Authorship) )
    g.add( (authorship_uri, VIVO.relates, publication_uri) )
    g.add( (authorship_uri, VIVO.relates, author_uri) )

    return g
Ejemplo n.º 2
0
            "@type": "@id"
        }
    }
}

positions = []

with open(sys.argv[1]) as infile:
    for count, row in enumerate(csv.DictReader(infile)):
        fac_id = row['person_ID']
        org_id = row['department_ID']
        title = row['job_title']

        #Create a hash local name for use in the URI.
        uri_parts = "{}{}{}".format(fac_id, org_id, title)
        position_uri = hash_uri(uri_parts, prefix='pos')

        pos = {}
        pos['uri'] = position_uri
        pos['a'] = 'vivo:FacultyPosition'
        pos['label'] = title
        #Multiple relation statements as list.
        pos['relates'] = [
            'fac{}'.format(fac_id),
            'org{}'.format(org_id)
        ]

        pos.update(pos_ctx)
        positions.append(pos)

Ejemplo n.º 3
0
            "@type": "@id"
        }
    }
}

positions = []

with open(sys.argv[1]) as infile:
    for count, row in enumerate(csv.DictReader(infile)):
        fac_id = row['person_ID']
        org_id = row['department_ID']
        title = row['job_title']

        #Create a hash local name for use in the URI.
        uri_parts = "{}{}{}".format(fac_id, org_id, title)
        position_uri = hash_uri(uri_parts, prefix='pos')

        pos = {}
        pos['uri'] = position_uri
        pos['a'] = 'vivo:FacultyPosition'
        pos['label'] = title
        #Multiple relation statements as list.
        pos['relates'] = ['fac{}'.format(fac_id), 'org{}'.format(org_id)]

        pos.update(pos_ctx)
        positions.append(pos)

raw_jld = json.dumps(positions)
g = Graph().parse(data=raw_jld, format='json-ld')
g.namespace_manager = ns_mgr
print g.serialize(format='turtle')