diff --git a/unsel_dashboard-iterate.ipynb b/unsel_dashboard-iterate.ipynb index c55b607553ba658bb86775893fd1595aebd03930..7f5e4a452490eb176f3dcbd43db239ad4e828cf0 100644 --- a/unsel_dashboard-iterate.ipynb +++ b/unsel_dashboard-iterate.ipynb @@ -344,6 +344,8 @@ " target_ref = CORPUS_DIR + corpus + '/current/*.ttl'\n", " for file_ref in glob(target_ref):\n", " if 'factoid' not in file_ref :\n", + " # Patch for new UWs with for instance .§A in restrictions\n", + " \n", " work_graph.parse(file_ref)\n", " \n", "def load_cts(work_graph): \n", @@ -493,14 +495,22 @@ " print(v_text)\n", " \n", "def loadFactoids(directory):\n", - " ttlList = glob(directory+\"/*/current/*.ttl\")\n", + " ttlList = glob(directory+\"/*/current/*_factoid.ttl\")\n", " g = Graph()\n", " for ttl in ttlList :\n", " g.parse(ttl)\n", " g.parse('/opt/dashboards/tools/tenet/frame/system-ontology.ttl')\n", + " return(g)\n", + "\n", + "def loadSentences(directory):\n", + " ttlList = glob(directory+\"/*/current/*.ttl\")\n", + " g = Graph()\n", + " for ttl in ttlList :\n", + " if 'factoid' not in ttl:\n", + " g.parse(ttl)\n", " g.parse('/opt/dashboards/tools/tenet/config/unl-rdf-schema.ttl')\n", " return(g)\n", - " \n", + "\n", "possibleUnderspecificationQuery ='''\n", "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", @@ -688,12 +698,17 @@ " 'warning':[possibleUnderspecificationQuery], \n", " 'info':[unfeaturedDomainOrRangeWithRefQuery]}\n", "\n", - "# On charge les factoïdes pour vérification des nouvelles phrases\n", + "# On charge les factoïdes puis les exigences pour vérification des nouvelles phrases\n", "g = loadFactoids(storeBase)\n", "sparqlUpdate.setQuery('INSERT DATA {'+g.serialize(format='nt')+'}')\n", "sparqlLog = sparqlUpdate.query()\n", "g.serialize(destination='/opt/dashboards/store/extraction2.ttl', format='turtle')\n", "owl2vowl('/opt/dashboards/store/extraction2.ttl')\n", + "\n", + "g = loadSentences(storeBase)\n", + "sparqlUpdate.setQuery('INSERT DATA {'+g.serialize(format='nt')+'}')\n", + "sparqlLog = sparqlUpdate.query()\n", + "\n", "#factoidList = [x.replace('..','/opt/dashboards') for x in glob(storeBase+\"/*/current/*factoid.ttl\")]\n", "#owl2vowl(FRAME_DIR + frame_file, importList=factoidList)\n", "\n", @@ -728,6 +743,7 @@ " graph, finalInferResult = applyInferStep(uuidStr, graph, 'generation_dga_patch')\n", " # -- Write result \n", " factoidPath = storeBase+uuidStr+'/current/'+uuidStr+'_factoid.ttl'\n", + " sentencePath = storeBase+uuidStr+'/current/'+uuidStr+'.ttl'\n", " with open(factoidPath, 'w') as outfile:\n", " outfile.write(finalInferResult)\n", " outfile.close()\n", @@ -736,6 +752,7 @@ " # -- Verification\n", " factoidGraph = Graph()\n", " factoidGraph.parse(factoidPath)\n", + " factoidGraph.parse(sentencePath) \n", " sparqlUpdate.setQuery('INSERT DATA {'+factoidGraph.serialize(format='nt')+'}')\n", " sparqlLog = sparqlUpdate.query()\n", " createVerificationMessages(storeBase+uuidStr)" @@ -1019,7 +1036,7 @@ " title=\"Inline Frame Example\"\n", " width=\"{}\"\n", " height=\"800\"\n", - " src=\"https://unsel.tetras-lab.io/webvowl/#extraction\">\n", + " src=\"https://unsel.tetras-lab.io/webvowl/#extraction2\">\n", " </iframe>'''.format(pane_width)),\n", " pn.Row(\n", " #pn.pane.HTML('<a href=\"https://unsel.tetras-lab.io/webvowl#extraction\" target=\"_blank\"><button type=\"button\" class=\"btn btn-outline-secondary btn-sm\">Visualiser l\\'ontologie construite pour tout le corpus</button><a>'),\n",