Add missing build and config files for Wikidata extension

This commit is contained in:
Antonin Delpeuch 2017-09-05 15:26:32 +01:00
parent 781c3b0467
commit 035e7b82bc
2 changed files with 206 additions and 0 deletions

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Google Refine Wikidata Extension Build File +-->
<project name="refine-wikidata-extension" default="build" basedir=".">
<property environment="env"/>
<condition property="version" value="trunk">
<not><isset property="version"/></not>
</condition>
<condition property="revision" value="rXXXX">
<not><isset property="revision"/></not>
</condition>
<condition property="full_version" value="0.0.0.0">
<not><isset property="full_version"/></not>
</condition>
<condition property="dist.dir" value="dist">
<not><isset property="dist.dir"/></not>
</condition>
<property name="fullname" value="${name}-${version}-${revision}" />
<property name="refine.dir" value="${basedir}/../../main" />
<property name="refine.webinf.dir" value="${refine.dir}/webapp/WEB-INF" />
<property name="refine.modinf.dir" value="${refine.dir}/webapp/modules/core/MOD-INF" />
<property name="refine.classes.dir" value="${refine.webinf.dir}/classes" />
<property name="refine.lib.dir" value="${refine.webinf.dir}/lib" />
<property name="server.dir" value="${basedir}/../../server" />
<property name="server.lib.dir" value="${server.dir}/lib" />
<property name="src.dir" value="${basedir}/src" />
<property name="rsrc.dir" value="${basedir}/resources" />
<property name="module.dir" value="${basedir}/module" />
<property name="modinf.dir" value="${module.dir}/MOD-INF" />
<property name="lib.dir" value="${modinf.dir}/lib" />
<property name="classes.dir" value="${modinf.dir}/classes" />
<path id="class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${refine.lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${server.lib.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement path="${refine.classes.dir}"/>
</path>
<target name="build_java" depends="copyfiles,copyresources">
<mkdir dir="${classes.dir}" />
<javac destdir="${classes.dir}" debug="true" includeAntRuntime="no">
<src path="${src.dir}"/>
<src path="${rsrc.dir}"/>
<classpath refid="class.path" />
</javac>
</target>
<target name="build" depends="build_java"/>
<target name="copyfiles">
<copy todir="${classes.dir}">
<fileset dir="${rsrc.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="copyresources">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.tsv"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${classes.dir}" />
</target>
</project>

View File

@ -0,0 +1,119 @@
/*
ExporterManager.MenuItems.push({});//add separator
ExporterManager.MenuItems.push(
{
"id" : "exportRdfXml",
"label":"RDF as RDF/XML",
"click": function() { RdfExporterMenuBar.exportRDF("rdf", "rdf");}
}
);
ExporterManager.MenuItems.push(
{
"id" : "exportRdfTurtle",
"label":"RDF as Turtle",
"click": function() { RdfExporterMenuBar.exportRDF("Turtle", "ttl"); }
}
);
RdfExporterMenuBar = {};
RdfExporterMenuBar.exportRDF = function(format, ext) {
if (!theProject.overlayModels.rdfSchema) {
alert(
"You haven't done any RDF schema alignment yet!"
);
} else {
RdfExporterMenuBar.rdfExportRows(format, ext);
}
};
RdfExporterMenuBar.rdfExportRows = function(format, ext) {
var name = $.trim(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-');
var form = document.createElement("form");
$(form)
.css("display", "none")
.attr("method", "post")
.attr("action", "command/core/export-rows/" + name + "." + ext)
.attr("target", "gridworks-export");
$('<input />')
.attr("name", "engine")
.attr("value", JSON.stringify(ui.browsingEngine.getJSON()))
.appendTo(form);
$('<input />')
.attr("name", "project")
.attr("value", theProject.id)
.appendTo(form);
$('<input />')
.attr("name", "format")
.attr("value", format)
.appendTo(form);
document.body.appendChild(form);
window.open("about:blank", "gridworks-export");
form.submit();
document.body.removeChild(form);
};
RdfExporterMenuBar.editRdfSchema = function(reset) {
new RdfSchemaAlignmentDialog(reset ? null : theProject.overlayModels.rdfSchema);
};
*/
ExporterManager.MenuItems.push(
{
"id" : "exportQuickStatements",
"label":"QuickStatements",
"click": function() { WikibaseExporterMenuBar.exportTo("quickstatements"); }
}
);
WikibaseExporterMenuBar = {};
WikibaseExporterMenuBar.exportTo = function(format) {
var form = document.createElement("form");
$(form).css("display", "none")
.attr("method", "post")
.attr("action", "command/core/export-rows/statements.txt")
.attr("target", "gridworks-export");
$('<input />')
.attr("name", "engine")
.attr("value", JSON.stringify(ui.browsingEngine.getJSON()))
.appendTo(form);
$('<input />')
.attr("name", "project")
.attr("value", theProject.id)
.appendTo(form);
$('<input />')
.attr("name", "format")
.attr("value", format)
.appendTo(form);
document.body.appendChild(form);
window.open("about:blank", "gridworks-export");
form.submit();
document.body.removeChild(form);
};
//extend the column header menu
$(function(){
ExtensionBar.MenuItems.push(
{
"id":"reconcile",
"label": "Wikidata",
"submenu" : [
{
"id": "wikidata/edit-schema",
label: "Edit Wikibase schema...",
click: function() { SchemaAlignmentDialog.launch(false); }
},
]
}
);
});