GithubHelp home page GithubHelp logo

Comments (7)

ferrigno avatar ferrigno commented on August 16, 2024 1

OK, sorry overreacted on assignment. Now, I think to understand. This timestamp field, which is inserted into the knowledge base, can be converted into a ISO date by reading it with the datetime python library.

So to select some recent ATeLs, it would be something like

from datetime import datetime
t_min = datetime.strptime('2021 01 01', '%Y %m %d').timestamp()
query='?p paper:source "ATel"; paper:timestamp ?t; paper:mentions_integral "title"; ?x ?y ' + \
    '. FILTER ( ?t > %ld )' % t_min
form='?p ?x ?y'
res_json = kb.sparql.select(query=query, form=form, limit=100000, only='?p ?x ?y', tojson=True)
res_dict=clean_res_json(res_json)
 
%make a dictionary
atel_numbers=sorted([int(aa.replace('paper:atel','')) for aa in res_dict.keys()], reverse=True)
%print
for n in atel_numbers:
    print('\\item ATeL %d '%n + res_dict['paper:atel%d'%n]['paper:title'][0] + ' %s ' % 
          datetime.fromtimestamp(int(res_dict['paper:atel%d'%n]['paper:timestamp'][0])).isoformat() )

It can be closed now, the information is present, but it needed to be decoded and I did not know how without your suggestion.

from literature-to-facts.

volodymyrss avatar volodymyrss commented on August 16, 2024

I am not sure what you mean by standard datetime format but the date is added in standard timestamp format, and was added since the atels were ingested:

https://github.com/oda-hub/literature-to-facts/blob/master/facts/atel.py#L30

from literature-to-facts.

ferrigno avatar ferrigno commented on August 16, 2024

What I mean is that
python -m facts.learn learn -t
produces a file called
knowledge.n3
in which a typical entry is:
paper:atel10069 paper:atelid 10069 ;
paper:location "http://www.astronomerstelegram.org/?read=10069" ;
paper:mentions_integral "title" ;
paper:source "ATel" ;
paper:timestamp 1486816860 ;
paper:title "INTEGRAL and ATCA observations of the black hole transient GRS 1716-249" .

So there is no date in the knowledge base even though a date field exist in atels.json produced by the command
python -m facts.atel -d parse-html ~/Dropbox/Public/ATels.html

Standard datetime could mean ISO
2021-04-12 22:00:10

from literature-to-facts.

ferrigno avatar ferrigno commented on August 16, 2024

I have no clue on how to solve this, so if you do not think it is useful, just close it. Useless that you assign it to me.

from literature-to-facts.

volodymyrss avatar volodymyrss commented on August 16, 2024

Here:

paper:timestamp 1486816860

this is date. In standard, zone-independent, numeric format (unix timestamp). Suitable for easy querying and sorting with all kinds of tools.

if you look on the link I quoted above, it's made from date:

https://github.com/oda-hub/literature-to-facts/blob/74af755/facts/atel.py#L30-L34

def atel_date(entry: ATelEntry) -> dict:  # date
    t = datetime.strptime(
        entry['date'].strip(), "%d %b %Y; %H:%M UT").timestamp()

    return dict(timestamp=t)

from literature-to-facts.

volodymyrss avatar volodymyrss commented on August 16, 2024

I have no clue on how to solve this, so if you do not think it is useful, just close it. Useless that you assign it to me.

I would suggest let us try to solve it by communicating and reading carefully.

Sorry I assigned just as I was writing a further comment, that must have been unclear.

from literature-to-facts.

volodymyrss avatar volodymyrss commented on August 16, 2024

I am not sure what you mean by standard datetime format but the date is added in standard timestamp format, and was added since the atels were ingested:

https://github.com/oda-hub/literature-to-facts/blob/master/facts/atel.py#L30

I try to be more clear, but I find my last comment repeats this one! Could you help me to explain it more clearly?

from literature-to-facts.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.