dice-group / FactCheck

9 stars 7 forks source link

running service #49

Open TobyJunhui opened 1 year ago

TobyJunhui commented 1 year ago

i have tried to run the service through the url 'http://localhost:8080/api/execTask/', but inside the code, there would be send a POST request. Is there only need two parameters? 'id' and 'filedata'. And how can i know what the string variable 'filedata' looks like?

MichaelRoeder commented 1 year ago

The POST request should contain the data as JSON:

{
  "taskid": "some ID", 
  "filedata": "the triple that should be checked in the Turtle serialization" 
}
TobyJunhui commented 1 year ago

Thanks for your reply, but im not so familiar with Turtle representation of RDF. Could you please give an intuitive example to me? like using the triplet (Albert Einstein, award, Nobel Prize in Physics) to construct the input parameter above. Much thanks! :)

MichaelRoeder commented 1 year ago

As triple from DBpedia: This answer was not correct. Sorry :disappointed:

TobyJunhui commented 1 year ago

Sorry to bother again! I used Postman to send a POST request with the json data that you described above, and i always got the 'null' value for the variable 'object'. Like the figure shows below, i tried debug into the function getObject(`), and both two JAVA 'if' statement always return flase. Im wondering the resaon why it happened. Could you please give a short analysis of this small piece of code? Actually is for when the statement 'objectNode.isLiteral()' would return true. Much thanks! catch

MichaelRoeder commented 1 year ago

Sorry, I had the wrong API in mind. I forgot that FactCheck still relies on the old DeFacto format :disappointed:

The format that it expects is the format of a single file of the FactBench dataset. You can find an example file at https://github.com/DeFacto/FactBench/blob/master/test/correct/award/award_00001.ttl I tested it locally with curl and sent the complete content of the file:

curl -H "Content-Type: application/json" -d "{\"taskid\": \"1\",\"filedata\": \"@prefix fbase: <http://rdf.freebase.com/ns> . @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> . @prefix dbo:   <http://dbpedia.org/ontology/> . @prefix owl:   <http://www.w3.org/2002/07/owl#> . @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> . @prefix skos:  <http://www.w3.org/2004/02/skos/core#> .  <http://rdf.freebase.com/ns/m.01vs81__1>         dbo:award  <http://rdf.freebase.com/ns/m.05f3q> ;         dbo:from   \\\"1901\\\"^^xsd:gYear ;         dbo:to     \\\"1901\\\"^^xsd:gYear .  <http://rdf.freebase.com/ns/m.05f3q>         rdfs:label     \\\"Nobel Peace Prize\\\"@en , \\\"Friedensnobelpreis\\\"@de , \\\"Prix Nobel de la paix\\\"@fr ;         owl:sameAs     <http://de.dbpedia.org/resource/Friedensnobelpreis> , <http://fr.dbpedia.org/resource/Prix_Nobel_de_la_paix> , <http://dbpedia.org/resource/Nobel_Peace_Prize> ;         skos:altLabel  \\\"Friedens-Nobelpreis\\\"@de , \\\"Nobel Prize for Peace\\\"@fr , \\\"Nobel Peace Laureate\\\"@fr , \\\"Nobel Prize for Peace\\\"@de , \\\"Nobelpreis für Frieden\\\"@de , \\\"Nobel Peace Laureate\\\"@de , \\\"Nobel Prize for Peace\\\"@en , \\\"Nobel Peace Laureate\\\"@en , \\\"Nobel peace prize\\\"@fr , \\\"Nobel peace prize\\\"@en , \\\"Nobel peace prize\\\"@de , \\\"Nobel peace laureate\\\"@fr , \\\"Nobel peace laureate\\\"@de , \\\"Nobel peace laureate\\\"@en , \\\"Peace\\\"@fr , \\\"Peace\\\"@de , \\\"Peace\\\"@en , \\\"Nobel Peace Prize Winner\\\"@fr , \\\"Nobel Peace Prize Winner\\\"@en , \\\"Nobel Peace Prize Winner\\\"@de , \\\"Peace Prize\\\"@fr , \\\"Peace Prize\\\"@de , \\\"Peace Prize\\\"@en , \\\"Nobel peace\\\"@fr , \\\"Nobel peace\\\"@de , \\\"Nobel peace\\\"@en , \\\"Nobel prize peace\\\"@fr , \\\"Nobel prize peace\\\"@de , \\\"Nobel prize peace\\\"@en , \\\"Nobel de la paix\\\"@fr , \\\"Prix nobel de la paix\\\"@fr , \\\"Nobel Peace Price\\\"@fr , \\\"Prix nobel de la Paix\\\"@fr , \\\"Nobel Peace Price\\\"@de , \\\"Nobel Peace Price\\\"@en , \\\"Nobel Peace prize\\\"@fr , \\\"Nobel Peace prize\\\"@en , \\\"Nobel Peace prize\\\"@de , \\\"Prix Nobel de la Paix\\\"@fr , \\\"Peace Nobel\\\"@fr , \\\"Peace Nobel\\\"@de , \\\"Peace Nobel\\\"@en , \\\"Nobelpreis fur Frieden\\\"@de , \\\"Friedensnobelpreis\\\"@de , \\\"Noble Peace Prize\\\"@fr , \\\"Noble Peace Prize\\\"@de , \\\"Noble Peace Prize\\\"@en , \\\"Nobel Prize in Peace\\\"@fr , \\\"Nobel Prize in Peace\\\"@en , \\\"Nobel Prize in Peace\\\"@de , \\\"2012 Nobel Peace Prize\\\"@fr , \\\"2012 Nobel Peace Prize\\\"@en , \\\"2012 Nobel Peace Prize\\\"@de , \\\"Nobel Peace Prixe\\\"@fr , \\\"Nobel Peace Prixe\\\"@en , \\\"Nobel Peace Prixe\\\"@de , \\\"PeacE\\\"@fr , \\\"PeacE\\\"@de , \\\"PeacE\\\"@en , \\\"Nobel Peace\\\"@fr , \\\"Nobel Peace\\\"@en , \\\"Nobel Peace\\\"@de , \\\"Nobel Peace Prize\\\"@fr , \\\"Nobel Peace Prize\\\"@en , \\\"Nobel Peace Prize\\\"@de , \\\"Prix Nobel de la paix\\\"@fr , \\\"Peace Award\\\"@fr , \\\"Peace Award\\\"@de , \\\"Peace Award\\\"@en , \\\"2001 Nobel Peace Prize\\\"@fr , \\\"Nobel Prize in peace\\\"@fr , \\\"2001 Nobel Peace Prize\\\"@de , \\\"2001 Nobel Peace Prize\\\"@en , \\\"Nobel Prize in peace\\\"@de , \\\"Nobel Prize in peace\\\"@en .  <http://rdf.freebase.com/ns/m.01vs81>         rdfs:label         \\\"Frédéric Passy\\\"@en , \\\"Frédéric Passy\\\"@de , \\\"Frédéric Passy\\\"@fr ;         dbo:recievedAward  <http://rdf.freebase.com/ns/m.01vs81__1> ;         owl:sameAs         <http://dbpedia.org/resource/Fr%C3%A9d%C3%A9ric_Passy> ;         skos:altLabel      \\\"Frederic Passy\\\"@en , \\\"Frederic Passy\\\"@en , \\\"Frédéric Passy\\\"@en .\"}" http://localhost:8080/api/execTask/

I would also suggest to use the version in the saveDataForTraining branch instead of the current master branch.

Please note that you should adapt the paths in the defacto.ini file since the web service will try to load the model and data according to these paths.