freme-project / basic-services

Apache License 2.0
0 stars 1 forks source link

Migrate data from dev to live #121

Closed jnehring closed 7 years ago

jnehring commented 7 years ago

1) sparql filter dkt-temp-output-as-web-annotation

2) pipeline nr. 9 http://api-dev.freme-project.eu/current/pipelining/chain/9?stats=false&useI18n=false

Uses an XSLT stylesheet that should be stored on dev.

3) XSLT filter tbx-to-schema-dot-org

This waits for https://github.com/freme-project/freme-ner/issues/175

jnehring commented 7 years ago

I restored the data from old database backups. Also I restored the XSLT stylesheet "e-terminology-to-schema-dot-org" which is used in the pipeline you mentioned.

@fsasaki I guess we should add this data to the FREME live installation at ADAPT also? Is this part of the official FREME distribution and should it there go also to the database files in initialising freme article?

This are the SQL queries I restored from the backups:

INSERT INTO `sparqlconverter` (`creation_time`, `description`, `visibility`, `name`, `query`, `owner_name`) VALUES 
(1463576321626,NULL,1,'dkt-temp-output-as-web-annotation','PREFIX itsrdf: <http://www.w3.org/2005/11/its/rdf#> \nprefix nif:  <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> \nprefix dktnif: <http://dkt.dfki.de/ontologies/nif#> \nprefix time:  <http://www.w3.org/2006/time#>  \nCONSTRUCT \n{  _:a0 \n  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> \n  <http://www.w3.org/ns/oa#Annotation>.\n _:a0 \n  <http://www.w3.org/ns/oa#hasTarget> \n _:b0. \n _:b0 \n  time:intervalStarts ?intervalS. _:b0 time:intervalFinishes ?intervalF. \n _:b0 \n  <http://www.w3.org/ns/oa#string> ?string. \n _:b0 \n  dktnif:meanDateStart ?meanDateStart. _:b0 dktnif:meanDateEnd ?meanDateEnd. \n _:b0 \n  <http://www.w3.org/ns/oa#hasSelector> \n _:b1 . \n _:b1 \n  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> \n  <http://www.w3.org/ns/oa#TextPositionSelector> . \n _:b1 \n  <http://www.w3.org/ns/oa#start> ?charbegin. \n _:b1 \n  <http://www.w3.org/ns/oa#end> ?charend. } \nWHERE  { { SELECT ?uri ?string ?charbegin ?charend ?intervalS ?intervalF ?meanDateStart ?meanDateEnd WHERE { ?uri nif:beginIndex ?charbegin. ?uri nif:endIndex ?charend. OPTIONAL {?uri itsrdf:taClassRef time:TemporalEntity. ?uri time:intervalStarts ?intervalS. ?uri time:intervalFinishes ?intervalF. ?uri nif:anchorOf ?string. } OPTIONAL {?uri dktnif:meanDateStart ?meanDateStart. ?uri dktnif:meanDateEnd ?meanDateEnd} } } }','admin');

INSERT INTO `pipeline` (`id`, `creation_time`, `description`, `visibility`, `label`, `persist`, `serialized_requests`, `owner_name`) VALUES 
(9,1474670806358,NULL,1,'terms-to-schema-dot-org','','[ {\n  \"method\" : \"POST\",\n  \"endpoint\" : \"http://api-dev.freme-project.eu/current/e-terminology/tilde\",\n  \"parameters\" : {\n    \"source-lang\" : \"en\",\n    \"target-lang\" : \"de\",\n    \"filter\" : \"terms-basic-infos\"\n  },\n  \"headers\" : {\n    \"accept\" : \"text/xml\"\n  },\n  \"body\" : null\n}, {\n  \"method\" : \"POST\",\n  \"endpoint\" : \"http://api-dev.freme-project.eu/current/toolbox/xslt-converter/documents/e-terminology-to-schema-dot-org\",\n  \"parameters\" : { },\n  \"headers\" : {\n    \"content-type\" : \"text/xml\",\n    \"accept\" : \"text/xml\"\n  },\n  \"body\" : null\n} ]','admin');

INSERT INTO `xsltconverter` (`creation_time`, `description`, `visibility`, `name`, `stylesheet`, `owner_name`) VALUES 
(1473431041042,'Conversion of TBX to Schema-dot-org',1,'tbx-to-schema-dot-org','<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Conversion of TBX to schema-dot-org\nTested with some examples from \nhttps://github.com/cimiano/tbx2rdf/blob/master/samples/. -->\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \n    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:schema=\"http://schema.org/\"\n    exclude-result-prefixes=\"xs schema rdf\"\n    version=\"2.0\">\n    <xsl:output method=\"html\" indent=\"yes\"/>\n    <xsl:param name=\"outputType\">json-ld</xsl:param>\n    <xsl:template match=\"/\">\n        <xsl:choose>\n            <xsl:when test=\"$outputType=\'rdf-xml-output\'\">\n                <xsl:call-template name=\"rdf-xml-output\"/>\n            </xsl:when>\n            <xsl:when test=\"$outputType=\'json-ld\'\">\n                <xsl:call-template name=\"json-ld-output\"/>\n            </xsl:when>\n            <xsl:otherwise>\n                <xsl:call-template name=\"json-ld-output\"/>\n            </xsl:otherwise>\n        </xsl:choose>\n    </xsl:template>\n    <xsl:template name=\"json-ld-output\">\n<script type=\"application/ld+json\"><xsl:text>[</xsl:text>\n<xsl:for-each select=\"//termEntry\">\n<xsl:for-each select=\"langSet\">\n<xsl:text>{\n\"@context\": \"http://schema.org/\",</xsl:text>\n<xsl:variable name=\"pos\"><xsl:number count=\"termEntry/langSet\" level=\"single\"/></xsl:variable>\n<xsl:variable name=\"id\"><xsl:value-of select=\"concat(parent::termEntry/@id,\'-\',$pos)\"/></xsl:variable>\n<xsl:text>&#xA;\"@id\": \"</xsl:text><xsl:value-of select=\"$id\"/>\",\n<xsl:if test=\"position() &gt; 1\">\n<xsl:variable name=\"id-first-langset\"><xsl:value-of select=\"concat(parent::termEntry/@id,\'-1\')\"/></xsl:variable>\n<xsl:text>\"sameAs\" : \"</xsl:text><xsl:value-of select=\"$id-first-langset\"/>\",\n</xsl:if>\n<xsl:text>\"@type\": \"CreativeWork\",</xsl:text>\n<xsl:text>&#xA;\"inLanguage\": \"</xsl:text><xsl:value-of select=\"@xml:lang\"/>\",\n    <xsl:text>\"name\": \"</xsl:text><xsl:for-each select=\".//term\"><xsl:value-of select=\"replace(.,\'&quot;\',\'\\\\&quot;\')\"/><xsl:if test=\"not(position()=last())\">,&#x20;</xsl:if></xsl:for-each><xsl:text>\"</xsl:text>\n<xsl:text>}</xsl:text><xsl:if test=\"not(position()=last())\">,&#xA;</xsl:if>\n</xsl:for-each>\n<xsl:if test=\"not(position()=last())\">,&#xA;</xsl:if>\n</xsl:for-each>\n<xsl:text>]</xsl:text></script>\n    </xsl:template>\n    <xsl:template name=\"rdf-xml-output\">\n        <rdf:RDF xmlns:schema=\"http://schema.org/\">\n        <xsl:for-each select=\"//termEntry\">\n            <xsl:for-each select=\"langSet\">\n            <xsl:variable name=\"pos\"><xsl:number count=\"termEntry/langSet\" level=\"single\"/></xsl:variable>\n            <xsl:variable name=\"id\"><xsl:value-of select=\"concat(parent::termEntry/@id,\'-\',$pos)\"/></xsl:variable>\n            <schema:CreativeWork rdf:about=\"{$id}\">\n                <xsl:if test=\"position() &gt; 1\">\n                    <xsl:variable name=\"id-first-langset\"><xsl:value-of select=\"concat(parent::termEntry/@id,\'-1\')\"/></xsl:variable>\n                    <schema:sameAs rdf:resource=\"{$id-first-langset}\"/>\n                </xsl:if>\n                <schema:name><xsl:for-each select=\".//term\"><xsl:value-of select=\".\"/><xsl:if test=\"not(position()=last())\">,&#x20;</xsl:if></xsl:for-each><xsl:text>\"</xsl:text></schema:name>\n                <schema:inLanguage><xsl:value-of select=\"@xml:lang\"/></schema:inLanguage>\n            </schema:CreativeWork>\n            </xsl:for-each>\n        </xsl:for-each>\n        </rdf:RDF>\n    </xsl:template>\n</xsl:stylesheet>','admin');

INSERT INTO `xsltconverter` (`creation_time`, `description`, `visibility`, `name`, `stylesheet`, `owner_name`) VALUES 
(1474644765142,'Conversion of e-terminology output to schema.org',1,'e-terminology-to-schema-dot-org','<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n    exclude-result-prefixes=\"xs rdf ontolex tbx xsd nif sr\"\n    xmlns:sr=\"http://www.w3.org/2005/sparql-results#\"\n    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n    xmlns:ontolex=\"http://www.w3.org/ns/lemon/ontolex#\"\n    xmlns:tbx=\"http://tbx2rdf.lider-project.eu/tbx#\"\n    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"\n    xmlns:nif=\"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#\" \n    version=\"2.0\">\n    <xsl:output method=\"html\" indent=\"yes\"/>\n    <xsl:template match=\"/\">\n        <script type=\"application/ld+json\"><xsl:text>[&#xA;</xsl:text>\n            <xsl:for-each select=\"/sr:sparql/sr:results/sr:result[sr:binding[@name=\'lexEntry\']]\">\n                    <xsl:text>{\n\"@context\": \"http://schema.org/\", &#xA;\"@id\" : \"</xsl:text> <xsl:value-of select=\"sr:binding[@name=\'lexEntry\']/sr:literal\"/><xsl:text>\",&#xA;\"type\" : \"CreativeWork\",&#xA;\"inLanguage\" : \"EN\",</xsl:text>\n                <xsl:text>&#xA;\"name\" : \"</xsl:text><xsl:value-of select=\"sr:binding[@name=\'new_writtenRep\']/sr:literal\"/><xsl:text>\"&#xA;}</xsl:text> \n                <xsl:if test=\"not(position()=last())\">,&#xA;</xsl:if>\n            </xsl:for-each>\n            <xsl:text>&#xA;,&#xA;</xsl:text>\n            <xsl:for-each select=\"/sr:sparql/sr:results/sr:result[sr:binding[@name=\'new_delexEntry\']]\">\n                <xsl:text>{\n\"@context\": \"http://schema.org/\", &#xA;\"@id\" : \"</xsl:text> <xsl:value-of select=\"concat(sr:binding[@name=\'lexEntry\']/sr:literal,\'-in-de\')\"/><xsl:text>\",&#xA;\"type\" : \"CreativeWork\",&#xA;\"inLanguage\" : \"DE\",</xsl:text>\n                <xsl:text>&#xA;\"name\" : \"</xsl:text><xsl:value-of select=\"sr:binding[@name=\'new_dewrittenRep\']/sr:literal\"/>\n                <xsl:text>\",&#xA;\"sameAs\" : \"</xsl:text><xsl:value-of select=\"sr:binding[@name=\'lexEntry\']/sr:literal\"/>\n                <xsl:text>\"&#xA;}</xsl:text> \n                <xsl:if test=\"not(position()=last())\">,&#xA;</xsl:if>\n            </xsl:for-each>\n            <xsl:text>&#xA;]</xsl:text>\n        </script>\n    </xsl:template>\n</xsl:stylesheet>','admin');
fsasaki commented 7 years ago

@fsasaki I guess we should add this data to the FREME live installation at ADAPT also? Is this part of the official FREME distribution and should it there go also to the database files in initialising freme article?

Thanks, Jan - yes, please add this to the live installation and the official FREME installation and the related article.

jnehring commented 7 years ago

@munnellg please execute these 4 SQL queries in your MySQL database to add the missing resources to the live installation.

jnehring commented 7 years ago

I updated the database dumps.

munnellg commented 7 years ago

@jnehring This should be done now

fsasaki commented 7 years ago

After the data base update I get with

https://api.freme-project.eu/current/toolbox/xslt-converter/documents/tbx-to-schema-dot-org?useI18n=false

and the attached input a 502 bad gateway. Does this request work for you guys?

2017-02-06 13:24 GMT+01:00 Gary Munnelly notifications@github.com:

@jnehring https://github.com/jnehring This should be done now

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/freme-project/basic-services/issues/121#issuecomment-277666334, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH5Aq-inirwHBxlGWNO3yzKnQDz74Ngks5rZxDggaJpZM4LubLF .

tbx-example.txt

fsasaki commented 7 years ago

Working now, issue probably was overlap with server re-start

munnellg commented 7 years ago

Just want to clarify, I have updated with the first, second and fourth SQL statement as we opted not to execute the third during our call

fsasaki commented 7 years ago

I tried

curl -X GET --header 'Accept: application/json' 'https://api.freme-project.eu/current/pipelining/templates/'

but I don't see the pipeline in the second SQL statement. Where can I find it?

jnehring commented 7 years ago

@munnellg added the pipeline