Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help needed for querying a KG other than wikidata #706

Open
valecarriero opened this issue Aug 1, 2023 · 0 comments
Open

help needed for querying a KG other than wikidata #706

valecarriero opened this issue Aug 1, 2023 · 0 comments

Comments

@valecarriero
Copy link

Hi, I successfully reused your tool for Wikidata (see wikidata empirical patterns project)

Now, I am trying to change the code such that it can be run on KGs other that Wikidata.
I am testing this with an ArCo KG release (see the NTriples dump)
I generated two kgtk files, with and without namespaces, with the following commands:

  1. kgtk --debug --timing import-ntriples --verbose -i arco.nt -o OUTPUT_FILE --reject-file REJECT_FILE --namespace-file NAMESPACE_FILE --updated-namespace-file NAMESPACE_FILE --build-id True --build-datatype-column True (see below for a snapshot)
  2. kgtk --debug --timing import-ntriples --verbose -i arco.nt -o OUTPUT_FILE --reject-file REJECT_FILE --build-id True --build-datatype-column True —build-new-namespaces=False (see below for a snapshot)

I tried in multiple ways, but I'm not able to do basic queries, like:

  • kgtk --debug query -i arco_output.tsv.gz --match '()-[n4:label]->()' --limit 10 does not return anything on the first kgtk file
  • kgtk --debug query -i arco_output.tsv.gz --match '()-[:label]->()' --limit 10 does not return anything on the first kgtk file
  • kgtk --debug query -i arco_output_nonamespaces.tsv.gz --match '()-[p]->()' --where 'p IN ["http://www.w3.org/2000/01/rdf-schema#label"]' --limit 10 does not return anything

But I really tried in many more different ways...

I am using an old version of KGTK (1.4.2) and python 3.9.13

What am I missing? :)
Thanks a lot for your support

1

node1   label   node2   datatype        id
n1:1200583495-heritage-protection-agency        n2:type n3:AgentRole            E1
n1:1200583495-heritage-protection-agency        n4:label        'Ente competente per tutela del bene 1200583495: S47'@it        n2:langString   E2
n1:1200583495-heritage-protection-agency        n4:label        'Heritage protection agency for cultural property 1200583495: S47'@en   n2:langString E3
n1:1200583495-heritage-protection-agency        n3:hasRole      n5:HeritageProtectionAgency             E4
n1:1200583495-heritage-protection-agency        n3:hasAgent     n6:d14d2c40c7af7b33e2d60f0fe31ad52f             E5
n7:terme-convento-nazionale     n2:type n8:SiteType             E6
n7:terme-convento-nazionale     n4:label        'Tipo di contenitore fisico: TERME; CONVENTO NAZIONALE'@it      n2:langString   E7
n7:terme-convento-nazionale     n9:name 'Tipo di contenitore fisico: TERME; CONVENTO NAZIONALE'@it      n2:langString   E8
n7:terme-convento-nazionale     n4:label        'Site type: TERME; CONVENTO NAZIONALE'@en       n2:langString   E9
n7:terme-convento-nazionale     n9:name 'Site type: TERME; CONVENTO NAZIONALE'@en       n2:langString   E10
[...]
n1      prefix_expansion        "https://w3id.org/arco/resource/AgentRole/"             E66993485
n10     prefix_expansion        "https://w3id.org/arco/resource/SiteDefinition/"                E66993486
n100    prefix_expansion        "https://w3id.org/arco/resource/Reuse/"         E66993487
n101    prefix_expansion        "https://w3id.org/arco/resource/CulturalPropertyPart/"          E66993488
n102    prefix_expansion        "https://w3id.org/arco/resource/LocationType/"          E66993489

2

node1   label   node2   datatype        id
https://w3id.org/arco/resource/AgentRole/1200583495-heritage-protection-agency  http://www.w3.org/1999/02/22-rdf-syntax-ns#type https://w3id.org/arco/ontology/core/AgentRole             E1
https://w3id.org/arco/resource/AgentRole/1200583495-heritage-protection-agency  http://www.w3.org/2000/01/rdf-schema#label      'Ente competente per tutela del bene 1200583495: S47'@it  http://www.w3.org/1999/02/22-rdf-syntax-ns#langString   E2
https://w3id.org/arco/resource/AgentRole/1200583495-heritage-protection-agency  http://www.w3.org/2000/01/rdf-schema#label      'Heritage protection agency for cultural property 1200583495: S47'@en     http://www.w3.org/1999/02/22-rdf-syntax-ns#langString   E3
https://w3id.org/arco/resource/AgentRole/1200583495-heritage-protection-agency  https://w3id.org/arco/ontology/core/hasRole     https://w3id.org/arco/resource/Role/HeritageProtectionAgency              E4
https://w3id.org/arco/resource/AgentRole/1200583495-heritage-protection-agency  https://w3id.org/arco/ontology/core/hasAgent    https://w3id.org/arco/resource/Agent/d14d2c40c7af7b33e2d60f0fe31ad52f             E5
https://w3id.org/arco/resource/SiteType/terme-convento-nazionale        http://www.w3.org/1999/02/22-rdf-syntax-ns#type https://w3id.org/arco/ontology/location/SiteType          E6
https://w3id.org/arco/resource/SiteType/terme-convento-nazionale        http://www.w3.org/2000/01/rdf-schema#label      'Tipo di contenitore fisico: TERME; CONVENTO NAZIONALE'@it        http://www.w3.org/1999/02/22-rdf-syntax-ns#langString   E7
https://w3id.org/arco/resource/SiteType/terme-convento-nazionale        https://w3id.org/italia/onto/l0/name    'Tipo di contenitore fisico: TERME; CONVENTO NAZIONALE'@it        http://www.w3.org/1999/02/22-rdf-syntax-ns#langString   E8
https://w3id.org/arco/resource/SiteType/terme-convento-nazionale        http://www.w3.org/2000/01/rdf-schema#label      'Site type: TERME; CONVENTO NAZIONALE'@en http://www.w3.org/1999/02/22-rdf-syntax-ns#langString   E9
https://w3id.org/arco/resource/SiteType/terme-convento-nazionale        https://w3id.org/italia/onto/l0/name    'Site type: TERME; CONVENTO NAZIONALE'@enhttp://www.w3.org/1999/02/22-rdf-syntax-ns#langString    E10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant