LinkedEarth / pylipd

Development repository for Python LiPD utilities
https://pylipd.readthedocs.io/en/latest/
Apache License 2.0
2 stars 0 forks source link

the author field is missing from publication #25

Closed khider closed 1 year ago

khider commented 1 year ago

The publication class is missing an author property

varunratnakar commented 1 year ago

Fixed in https://github.com/LinkedEarth/pylipd/commit/f57a6da08ea069d948bdb87c5f5c4b4082c96412

khider commented 1 year ago

Still missing the authors...

varunratnakar commented 1 year ago

Can you give me some example code. Unable to replicate

On Fri, 24 Feb 2023, 04:02 Deborah Khider, @.***> wrote:

Reopened #25 https://github.com/LinkedEarth/pylipd/issues/25.

— Reply to this email directly, view it on GitHub https://github.com/LinkedEarth/pylipd/issues/25#event-8596516128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGTB6QXREC6CJHV6GK6PQMTWY7QODANCNFSM6AAAAAAVDXYXCE . You are receiving this because you modified the open/close state.Message ID: @.***>

khider commented 1 year ago
from pylipd.lipd import LiPD
from doi2bib import crossref
from pybtex.database import BibliographyData, Entry
import io
import re
import random
import string

L = LiPD()
data = ['https://lipdverse.org/data/TjhHrDv0LQ4aazHolZkR/1_0_0//Ocn-WEqPacific.Stott.2007.lpd',
       '/Users/deborahkhider/Documents/GitHub/PyleoTutorials/data/Ocn-Palmyra.Nurhati.2011.lpd']
L.load(data)

L.set_endpoint("https://linkedearth.graphdb.mint.isi.edu/repositories/LiPDVerse2")
L.load_remote_datasets(["MD98_2181.Stott.2007","NAm-SmithersSkiArea.Schweingruber.1996", 
                        "NAm-CeaderBreaks.Briffa.1996", "ODP1671017E", 
                        "SPC14.Kahle.2021", "RC12-10.Poore.2003", 
                        "MD02-2553.Poore.2009", "AD9117.Guinta.2001",
                        "SchellingsBog.Barron.2004", "Hidden.Tang.1999"])
query = """PREFIX le: <http://linked.earth/ontology#>
select ?author ?doi ?year ?pubyear ?title ?journal ?volume ?issue ?pages ?type ?publisher ?report ?citeKey ?edition ?institution where { 
    ?ds a le:Dataset .
    ?ds le:publishedIn ?pub .
        OPTIONAL{?pub le:hasDOI ?doi .}
        OPTIONAL{?pub le:author ?author .}
        OPTIONAL{?pub le:publicationYear ?year .}
        OPTIONAL{?pub le:pubYear ?pubyear .}
        OPTIONAL{?pub le:title ?title .}
        OPTIONAL{?pub le:journal ?journal .}
        OPTIONAL{?pub le:volume ?volume .}
        OPTIONAL{?pub le:issue ?issue .}
        OPTIONAL{?pub le:pages ?pages .}
        OPTIONAL{?pub le:type ?type .}
        OPTIONAL{?pub le:publisher ?publisher .}
        OPTIONAL{?pub le:report ?report .}
        OPTIONAL{?pub le:citeKey ?citeKey .}
        OPTIONAL{?pub le:edition ?edition .}
        OPTIONAL{?pub le:institution ?institution .}
}"""

result, df = L.query(query)

I was also looking for what to query by doing this:

g = L.graph

pub_property=[]
for subj, pred, obj in g:
    if 'publication' in subj.lower():
        pub_property.append(pred)
from collections import Counter
Counter(pub_property)

And not authors...

varunratnakar commented 1 year ago

Should be fixed in https://github.com/LinkedEarth/pylipd/commit/978714089e670112fe0a142e48224ee20c9560b8 https://github.com/LinkedEarth/pylipd/commit/8971a21d0c62f9f766d0df358581f58c3f3f1565

Note: This will not work for GraphDB, as the triples in GraphDB are missing the author fields due to this bug. That will have to be repopulated. Edit: Fixed for GraphDB (Repopulated Data)