wala / graph4code

GraphGen4Code: a toolkit for creating code knowledge graphs based on WALA code analysis and extraction of documentation and forum content.
https://wala.github.io/graph4code/
Eclipse Public License 2.0
215 stars 31 forks source link

Need Help with flowsTo Query on example1.nq sample #17

Closed amitabh1 closed 1 year ago

amitabh1 commented 1 year ago

Hi, i am able to run the following query on Apache Jena on example1.nq file, however the query clause ?read graph4code:flowsTo+ ?fit1 . , is not returning the flowsTo objects, is there anything missing to connect the data flow on pandas.read_csv

Query : PREFIX sio: http://semanticscience.org/resource/ PREFIX graph4code: http://purl.org/twc/graph4code/ PREFIX schema: http://schema.org/ PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#

select * where { graph ?g { ?read rdfs:label "pandas.read_csv." . ?fit1 schema:about "fit" .

?read graph4code:flowsTo+ ?fit1 .

    ?clf rdfs:label ?name .
    ?clf sio:SIO_000061 ?p .
    ?clf schema:text ?txt .
}

}

ksrinivs64 commented 1 year ago

Hi, I am not sure those examples are updated - we changed the graph representation at some point and actually moved away from the nq representation to JSON. I've created an updated example in: output/static_analysis. Please if possible see if the JSON representation helps you get what you need because that is the representation we work off of. You can always convert that to a graph if you need transitive closure?

amitabh1 commented 1 year ago

Thanks for the pointer, do you have a query sample against this dataset. I can try the json files.

Is there a recommended tool where the json can be loaded for graphical representation.

ksrinivs64 commented 1 year ago

Hi, no because we use jq to gather what we need or just load the JSON up and pick up what we need. For graphical representation - look at this notebook: https://github.com/wala/graph4code/blob/master/semForms/ExampleAnalysis.ipynb. It shows you how to view the analysis artifacts as a graph. It is meant for illustrative purposes but feel free to extend it with fields in the JSON if you want them. And if you do do that, do contribute back! Thanks!