Revision: 311
Author:
k.j.w.a...@gmail.com
Date: Fri Jul 29 08:34:10 2011
Log: merging to trunk changes adding mirror_from_url and
submit_ntriples_from_file_in_batches
http://code.google.com/p/moriarty/source/detail?r=311
Added:
/trunk/tests/documents/10-ntriples.nt
/trunk/tests/documents/after.ttl
/trunk/tests/documents/before.rdf
/trunk/tests/documents/before.ttl
/trunk/tests/documents/ckan-ds.ttl
/trunk/tests/httpresponse.test.php
Modified:
/trunk
/trunk/augmentservice.class.php
/trunk/build.xml
/trunk/changeset.class.php
/trunk/changesetbatch.class.php
/trunk/constants.inc.php
/trunk/contentbox.class.php
/trunk/credentials.class.php
/trunk/curlhttpclient.class.php
/trunk/datatable.class.php
/trunk/datatableresult.class.php
/trunk/etc/phingBootstrap.php
/trunk/examples/helloworld.php
/trunk/facetservice.class.php
/trunk/fieldpredicatemap.class.php
/trunk/graph.class.php
/trunk/graphpath.class.php
/trunk/httpcache.class.php
/trunk/httprequest.class.php
/trunk/httprequestfactory.class.php
/trunk/httpresponse.class.php
/trunk/jobqueue.class.php
/trunk/labeller.class.php
/trunk/metabox.class.php
/trunk/moriarty.inc.php
/trunk/multisparqlservice.class.php
/trunk/networkresource.class.php
/trunk/oaiservice.class.php
/trunk/phing.xml
/trunk/phphttpclient.class.php
/trunk/privategraph.class.php
/trunk/queryprofile.class.php
/trunk/rollback.class.php
/trunk/simplegraph.class.php
/trunk/snapshots.class.php
/trunk/sparqlservice.class.php
/trunk/sparqlservicebase.class.php
/trunk/store.class.php
/trunk/storecollection.class.php
/trunk/storegroup.class.php
/trunk/storegroupconfig.class.php
/trunk/tests/augmentservice.test.php
/trunk/tests/curlhttpclient.test.php
/trunk/tests/graph.test.php
/trunk/tests/runtests.php
/trunk/tests/simplegraph.test.php
/trunk/tests/store.test.php
/trunk/union.class.php
/trunk/valuepool.class.php
=======================================
--- /dev/null
+++ /trunk/tests/documents/10-ntriples.nt Fri Jul 29 08:34:10 2011
@@ -0,0 +1,10 @@
+<
http://example.com/a> <
http://example.com/b> 1 .
+<
http://example.com/a> <
http://example.com/b> 2 .
+<
http://example.com/a> <
http://example.com/b> 3 .
+<
http://example.com/a> <
http://example.com/b> 4 .
+<
http://example.com/a> <
http://example.com/b> 5 .
+<
http://example.com/a> <
http://example.com/b> 6 .
+<
http://example.com/a> <
http://example.com/b> 7 .
+<
http://example.com/a> <
http://example.com/b> 8 .
+<
http://example.com/a> <
http://example.com/b> 9 .
+<
http://example.com/a> <
http://example.com/b> 10 .
=======================================
--- /dev/null
+++ /trunk/tests/documents/after.ttl Fri Jul 29 08:34:10 2011
@@ -0,0 +1,2 @@
+@prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
=======================================
--- /dev/null
+++ /trunk/tests/documents/before.rdf Fri Jul 29 08:34:10 2011
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rdf:RDF xmlns:climb="
http://climb.dataincubator.org/vocabs/climb/"
xmlns:dc="
http://purl.org/dc/elements/1.1/"
xmlns:dct="
http://purl.org/dc/terms/"
xmlns:dctype="
http://purl.org/dc/dcmitype/"
xmlns:foaf="
http://xmlns.com/foaf/0.1/"
xmlns:geo="
http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:ns0="
http://climb.dataincubator.org/rockTypes/"
xmlns:ov="
http://open.vocab.org/terms/"
xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="
http://www.w3.org/2000/01/rdf-schema#">
+ <rdf:Description rdf:about="
http://example.org/examples/a">
+ <foaf:knows rdf:resource="
http://example.org/examples/b"/>
+ </rdf:Description>
+</rdf:RDF>
=======================================
--- /dev/null
+++ /trunk/tests/documents/before.ttl Fri Jul 29 08:34:10 2011
@@ -0,0 +1,14 @@
+@prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix climb: <
http://climb.dataincubator.org/vocabs/climb/> .
+@prefix dc: <
http://purl.org/dc/elements/1.1/> .
+@prefix dct: <
http://purl.org/dc/terms/> .
+@prefix dctype: <
http://purl.org/dc/dcmitype/> .
+@prefix foaf: <
http://xmlns.com/foaf/0.1/> .
+@prefix geo: <
http://www.w3.org/2003/01/geo/wgs84_pos#> .
+@prefix ns0: <
http://climb.dataincubator.org/rockTypes/> .
+@prefix ov: <
http://open.vocab.org/terms/> .
+@prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
+
+<
http://example.org/examples/a>
+ foaf:knows <
http://example.org/examples/b> .
+
=======================================
--- /dev/null
+++ /trunk/tests/documents/ckan-ds.ttl Fri Jul 29 08:34:10 2011
@@ -0,0 +1,288 @@
+@prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix dc: <
http://purl.org/dc/terms/> .
+@prefix dcat: <
http://www.w3.org/ns/dcat#> .
+@prefix foaf: <
http://xmlns.com/foaf/0.1/> .
+@prefix gis: <
http://www.opengis.net/rdf#> .
+@prefix lic: <
http://purl.org/okfn/licenses/> .
+@prefix moat: <
http://moat-project.org/ns#> .
+@prefix opmv: <
http://purl.org/net/opmv/ns#> .
+@prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rev: <
http://purl.org/stuff/rev#> .
+@prefix time: <
http://www.w3.org/2006/time#> .
+@prefix void: <
http://rdfs.org/ns/void#> .
+@prefix xsd: <
http://www.w3.org/2001/XMLSchema#> .
+@prefix ns1: <
http://semantic.ckan.net/schema#> .
+
+<
http://ckan.net/package/fu-berlin-diseasome>
+ moat:taggedWithTag <
http://ckan.net/tag/deref-vocab>,
<
http://ckan.net/tag/lifesciences>, <
http://ckan.net/tag/lod>,
<
http://ckan.net/tag/no-license-metadata>,
<
http://ckan.net/tag/no-provenance-metadata>,
<
http://ckan.net/tag/published-by-third-party>,
<
http://ckan.net/tag/vocab-mappings>,
<
http://ckan.net/tag/void-sparql-endpoint> ;
+ dc:contributor [
+ foaf:mbox <mailto:
an...@anjeve.de> ;
+ foaf:name "Anja Jentzsch"
+ ] ;
+ dc:created "2007-04-10T21:19:38Z"^^xsd:dateTime ;
+ dc:description """<p>Linked Data version of Diseasome publishes a
network of 4,300 disorders and disease genes linked by known disorder-gene
associations for exploring all known phenotype and disease gene
associations, indicating the common genetic origin of many diseases. The
list of disorders, disease genes, and associations between them was
obtained from the Online Mendelian Inheritance in Man (OMIM), a compilation
of human disease genes and phenotypes.
+</p>
+<p>OMIM Data Use from
http://www.ncbi.nlm.nih.gov/Omim/restrictions.html
+</p>
+<p>Copyright © 1966-2008 Johns Hopkins University.
+</p>
+<p>The OMIM® database including the collective data contained therein is
the property of the Johns Hopkins University, which holds the copyright
thereto.
+</p>
+<p>The OMIM database is made available to the general public subject to
certain restrictions. You may use the OMIM database and data obtained from
this site for your personal use, for educational or scholarly use, or for
research purposes only. The OMIM database may not be copied, distributed,
transmitted, duplicated, reduced or altered in any way for commercial
purposes, or for the purpose of redistribution, without a license from the
Johns Hopkins University.
+</p>
+<p>Requests for information regarding a license for commercial use or
redistribution of the OMIM database may be sent via e-mail to
JHTT-Comm...@jhmi.edu.
+</p>
+<p>links:bio2rdf-symbol: 9743
+</p>""" ;
+
dc:identifier "fa439987-64dc-404c-bc2b-ee5d173f3d62", "fu-berlin-diseasome" ;
+ dc:isPartOf <
http://ckan.net/group/lodcloud> ;
+ dc:maintainer [
+ foaf:mbox <mailto:
an...@anjeve.de> ;
+ foaf:name "Anja Jentzsch"
+ ] ;
+ dc:modified "2011-07-24T11:59:35Z"^^xsd:dateTime ;
+ dc:rights lic:other-nc ;
+ dc:title "Diseasome" ;
+ rev:rating "5.00"^^xsd:float ;
+ void:exampleResource
<
http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/74> ;
+ void:sparqlEndpoint
<
http://www4.wiwiss.fu-berlin.de/diseasome/sparql> ;
+ void:subset [
+ void:target <
http://ckan.net/package/bio2rdf-hgnc>,
<
http://ckan.net/package/fu-berlin-diseasome> ;
+ void:triples 688 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/fu-berlin-diseasome>,
<
http://ckan.net/package/fu-berlin-sider> ;
+ void:triples 238 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/fu-berlin-dailymed>,
<
http://ckan.net/package/fu-berlin-diseasome> ;
+ void:triples 6124 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/fu-berlin-diseasome>,
<
http://ckan.net/package/linkedct> ;
+ void:triples 372 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/fu-berlin-diseasome>,
<
http://ckan.net/package/fu-berlin-drugbank> ;
+ void:triples 8202 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/fu-berlin-diseasome>,
<
http://ckan.net/package/tcmgenedit_dataset> ;
+ void:triples 376 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/dbpedia>,
<
http://ckan.net/package/fu-berlin-diseasome> ;
+ void:triples 1943 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/bio2rdf-omim>,
<
http://ckan.net/package/fu-berlin-diseasome> ;
+ void:triples 2929 ;
+ a void:Linkset
+ ], [
+ void:target <
http://ckan.net/package/bio2rdf-geneid>,
<
http://ckan.net/package/fu-berlin-diseasome> ;
+ void:triples 688 ;
+ a void:Linkset
+ ] ;
+ void:triples 91182 ;
+ ns1:extra [
+ rdf:value "6124" ;
+ rdfs:label "links:fu-berlin-dailymed" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:fu-berlin-dailymed>
+ ], [
+ rdf:value "372" ;
+ rdfs:label "links:linkedct" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:linkedct>
+ ], [
+ rdf:value "8202" ;
+ rdfs:label "links:fu-berlin-drugbank" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:fu-berlin-drugbank>
+ ], [
+ rdf:value "376" ;
+ rdfs:label "links:tcmgenedit_dataset" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:tcmgenedit_dataset>
+ ], [
+ rdf:value "1943" ;
+ rdfs:label "links:dbpedia" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:dbpedia>
+ ], [
+ rdf:value "2929" ;
+ rdfs:label "links:bio2rdf-omim" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:bio2rdf-omim>
+ ], [
+ rdf:value "91182" ;
+ rdfs:label "triples" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/triples>
+ ], [
+ rdf:value "688" ;
+ rdfs:label "links:bio2rdf-geneid" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:bio2rdf-geneid>
+ ], [
+ rdf:value "688" ;
+ rdfs:label "links:bio2rdf-hgnc" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:bio2rdf-hgnc>
+ ], [
+ rdf:value "238" ;
+ rdfs:label "links:fu-berlin-sider" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/links:fu-berlin-sider>
+ ], [
+ rdf:value "
http://www4.wiwiss.fu-berlin.de/diseasome/resource/" ;
+ rdfs:label "namespace" ;
+ rdfs:seeAlso <
http://wiki.ckan.net/extras/namespace>
+ ] ;
+ ns1:json "{\"author\":\"Anja
Jentzsch\",\"author_email\":\"
an...@anjeve.de\",\"ckan_url\":\"
http://ckan.net/package/fu-berlin-diseasome\",\"download_url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/sparql\",\"extras\":{\"links:bio2rdf-geneid\":\"688\",\"links:bio2rdf-hgnc\":\"688\",\"links:bio2rdf-omim\":\"2929\",\"links:dbpedia\":\"1943\",\"links:fu-berlin-dailymed\":\"6124\",\"links:fu-berlin-drugbank\":\"8202\",\"links:fu-berlin-sider\":\"238\",\"links:linkedct\":\"372\",\"links:tcmgenedit_dataset\":\"376\",\"namespace\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/resource/\",\"triples\":\"91182\"},\"groups\":[\"lodcloud\"],\"id\":\"fa439987-64dc-404c-bc2b-ee5d173f3d62\",\"license\":\"Non-OKD
Compliant::Other
(Non-Commercial)\",\"license_id\":\"other-nc\",\"maintainer\":\"Anja
Jentzsch\",\"maintainer_email\":\"
an...@anjeve.de\",\"metadata_created\":\"2007-04-10T21:19:38\",\"metadata_modified\":\"2011-07-24T11:59:35.616364\",\"name\":\"fu-berlin-diseasome\",\"notes\":\"Linked
Data version of Diseasome publishes a network of 4,300 disorders and
disease genes linked by known disorder-gene associations for exploring all
known phenotype and disease gene associations, indicating the common
genetic origin of many diseases. The list of disorders, disease genes, and
associations between them was obtained from the Online Mendelian
Inheritance in Man (OMIM), a compilation of human disease genes and
phenotypes.\\u000d\\u000a\\u000d\\u000aOMIM Data Use from
http://www.ncbi.nlm.nih.gov/Omim/restrictions.html\\u000d\\u000a\\u000d\\u000aCopyright
© 1966-2008 Johns Hopkins University.\\u000d\\u000a\\u000d\\u000aThe OMIM®
database including the collective data contained therein is the property of
the Johns Hopkins University, which holds the copyright
thereto.\\u000d\\u000a\\u000d\\u000aThe OMIM database is made available to
the general public subject to certain restrictions. You may use the OMIM
database and data obtained from this site for your personal use, for
educational or scholarly use, or for research purposes only. The OMIM
database may not be copied, distributed, transmitted, duplicated, reduced
or altered in any way for commercial purposes, or for the purpose of
redistribution, without a license from the Johns Hopkins
University.\\u000d\\u000a\\u000d\\u000aRequests for information regarding a
license for commercial use or redistribution of the OMIM database may be
sent via e-mail to
JHTT-Comm...@jhmi.edu.\\u000d\\u000a\\u000d\\u000a\\u000d\\u000alinks:bio2rdf-symbol:
9743\",\"notes_rendered\":\"<p>Linked Data version of Diseasome publishes a
network of 4,300 disorders and disease genes linked by known disorder-gene
associations for exploring all known phenotype and disease gene
associations, indicating the common genetic origin of many diseases. The
list of disorders, disease genes, and associations between them was
obtained from the Online Mendelian Inheritance in Man (OMIM), a compilation
of human disease genes and phenotypes.\\u000a</p>\\u000a<p>OMIM Data Use
from
http://www.ncbi.nlm.nih.gov/Omim/restrictions.html\\u000a</p>\\u000a<p>Copyright
© 1966-2008 Johns Hopkins University.\\u000a</p>\\u000a<p>The OMIM®
database including the collective data contained therein is the property of
the Johns Hopkins University, which holds the copyright
thereto.\\u000a</p>\\u000a<p>The OMIM database is made available to the
general public subject to certain restrictions. You may use the OMIM
database and data obtained from this site for your personal use, for
educational or scholarly use, or for research purposes only. The OMIM
database may not be copied, distributed, transmitted, duplicated, reduced
or altered in any way for commercial purposes, or for the purpose of
redistribution, without a license from the Johns Hopkins
University.\\u000a</p>\\u000a<p>Requests for information regarding a
license for commercial use or redistribution of the OMIM database may be
sent via e-mail to
JHTT-Comm...@jhmi.edu.\\u000a</p>\\u000a<p>links:bio2rdf-symbol:
9743\\u000a</p>\",\"ratings_average\":5,\"ratings_count\":1,\"relationships\":[],\"resources\":[{\"description\":\"SPARQL
endpoint\",\"format\":\"api/sparql\",\"hash\":\"\",\"id\":\"0788fb71-3581-4281-b34e-bbe60503c452\",\"package_id\":\"fa439987-64dc-404c-bc2b-ee5d173f3d62\",\"position\":0,\"resource_group_id\":\"bc18f952-a8a6-a132-cbcc-9d594f379459\",\"url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/sparql\"},{\"description\":\"N-Triples,
bz2
packed\",\"format\":\"application/x-ntriples\",\"hash\":\"\",\"id\":\"15ed9b1e-938a-40e9-b11b-c848741182bf\",\"package_id\":\"fa439987-64dc-404c-bc2b-ee5d173f3d62\",\"position\":1,\"resource_group_id\":\"bc18f952-a8a6-a132-cbcc-9d594f379459\",\"url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/diseasome_dump.nt.bz2\"},{\"description\":\"XML
Sitemap\",\"format\":\"meta/sitemap\",\"hash\":\"\",\"id\":\"89873558-a690-4f82-9b11-abf0f10d0d5e\",\"package_id\":\"fa439987-64dc-404c-bc2b-ee5d173f3d62\",\"position\":2,\"resource_group_id\":\"bc18f952-a8a6-a132-cbcc-9d594f379459\",\"url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/sitemap.xml\"},{\"description\":\"Example
resource\",\"format\":\"example/rdf+xml\",\"hash\":\"\",\"id\":\"e5333f25-5db8-45a4-8c52-daa9cb3a5ddf\",\"package_id\":\"fa439987-64dc-404c-bc2b-ee5d173f3d62\",\"position\":3,\"resource_group_id\":\"bc18f952-a8a6-a132-cbcc-9d594f379459\",\"url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/74\"}],\"revision_id\":\"c2c9d824-7db2-40b5-bf4f-67e4af7e0460\",\"state\":\"active\",\"tags\":[\"deref-vocab\",\"lifesciences\",\"lod\",\"no-license-metadata\",\"no-provenance-metadata\",\"published-by-third-party\",\"vocab-mappings\",\"void-sparql-endpoint\"],\"title\":\"Diseasome\",\"url\":\"
http://www4.wiwiss.fu-berlin.de/diseasome/\",\"version\":\"\"}" ;
+ a dcat:Dataset ;
+ dcat:distribution [
+ dc:description "SPARQL endpoint" ;
+ dc:format [
+ moat:taggedWithTag [
+ moat:name "api/sparql" ;
+ a moat:Tag
+ ] ;
+ a dc:IMT ;
+ rdf:value "application/sparql-results+xml" ;
+ rdfs:label "SPARQL"
+ ] ;
+ a dcat:Distribution ;
+ dcat:accessURL <
http://www4.wiwiss.fu-berlin.de/diseasome/sparql>
+ ], [
+ dc:description "N-Triples, bz2 packed" ;
+ dc:format [
+ moat:taggedWithTag [
+ moat:name "application/x-ntriples" ;
+ a moat:Tag
+ ] ;
+ a dc:IMT
+ ] ;
+ a dcat:Distribution ;
+ dcat:accessURL
<
http://www4.wiwiss.fu-berlin.de/diseasome/diseasome_dump.nt.bz2>
+ ], [
+ dc:description "XML Sitemap" ;
+ dc:format [
+ moat:taggedWithTag [
+ moat:name "meta/sitemap" ;
+ a moat:Tag
+ ] ;
+ a dc:IMT
+ ] ;
+ a dcat:Distribution ;
+ dcat:accessURL
<
http://www4.wiwiss.fu-berlin.de/diseasome/sitemap.xml>
+ ], [
+ dc:description "Example resource" ;
+ dc:format [
+ moat:taggedWithTag [
+ moat:name "example/rdf+xml" ;
+ a moat:Tag
+ ] ;
+ a dc:IMT ;
+ rdf:value "application/rdf+xml" ;
+ rdfs:label "RDF/XML"
+ ] ;
+ a dcat:Distribution ;
+ dcat:accessURL
<
http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/74>
+ ] ;
+ foaf:homepage <
http://www4.wiwiss.fu-berlin.de/diseasome/> .
+
+<
http://ckan.net/tag/deref-vocab>
+ moat:name "deref-vocab" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/lifesciences>
+ moat:name "lifesciences" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/lod>
+ moat:name "lod" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/no-license-metadata>
+ moat:name "no-license-metadata" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/no-provenance-metadata>
+ moat:name "no-provenance-metadata" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/published-by-third-party>
+ moat:name "published-by-third-party" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/vocab-mappings>
+ moat:name "vocab-mappings" ;
+ a moat:Tag .
+
+<
http://ckan.net/tag/void-sparql-endpoint>
+ moat:name "void-sparql-endpoint" ;
+ a moat:Tag .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62>
+ dc:source <
http://ckan.net/> ;
+ opmv:wasGeneratedBy [
+ opmv:used <
http://ckan.net/api/rest/package/fu-berlin-diseasome>,
<
http://ckan.net/api/rest/revision/c2c9d824-7db2-40b5-bf4f-67e4af7e0460> ;
+ opmv:wasControlledBy [
+ a foaf:Agent ;
+ foaf:name "GoLD CKAN 1.0"
+ ] ;
+ opmv:wasPerformedAt [
+ a time:Instant ;
+ time:inXSDDateTime "2011-07-27T05:14:47Z"^^xsd:dateTime
+ ] ;
+ a opmv:Process
+ ] ;
+ a dcat:CatalogRecord ;
+ dcat:dataset <
http://ckan.net/package/fu-berlin-diseasome> ;
+ foaf:isPrimaryTopicOf
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.dot>,
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.html>,
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.json>,
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.nt>,
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.rdf>,
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.ttl> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.dot>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "text/x-graphviz" ;
+ rdfs:label "Graphviz"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.html>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "application/xhtml+xml" ;
+ rdfs:label "HTML"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.json>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "text/javascript" ;
+ rdfs:label "JSON"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.nt>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "text/plain" ;
+ rdfs:label "N-Triples"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.rdf>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "application/rdf+xml" ;
+ rdfs:label "RDF/XML"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
+<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62.ttl>
+ dc:format [
+ a dc:IMT ;
+ rdf:value "application/turtle" ;
+ rdfs:label "Turtle"
+ ] ;
+ a foaf:Document ;
+ foaf:primaryTopic
<
http://semantic.ckan.net/record/fa439987-64dc-404c-bc2b-ee5d173f3d62> .
+
=======================================
--- /dev/null
+++ /trunk/tests/httpresponse.test.php Fri Jul 29 08:34:10 2011
@@ -0,0 +1,20 @@
+<?php
+require_once dirname(dirname(__FILE__)) .
DIRECTORY_SEPARATOR . 'constants.inc.php';
+require_once MORIARTY_DIR . 'httpresponse.class.php';
+require_once MORIARTY_TEST_DIR . 'fakecredentials.class.php';
+require_once MORIARTY_TEST_DIR . 'fakecache.class.php';
+
+class HttpResponseTest extends PHPUnit_Framework_TestCase {
+
+
+ function test_get_content_type(){
+
+ $response = new HttpResponse('200');
+ $response->headers = array('content-type'=> 'text/html');
+ $this->assertEquals('text/html',
$response->get_content_type(), 'Content type should be text/html');
+ $response->headers = array('Content-Type'=> 'text/xml');
+ $this->assertEquals('text/xml',
$response->get_content_type(), 'Content type should be text/xml');
+
+ }
+}
+?>
=======================================
--- /trunk/augmentservice.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/augmentservice.class.php Fri Jul 29 08:34:10 2011
@@ -59,7 +59,14 @@
$request = $this->request_factory->make( 'POST', $this->uri ,
$this->credentials );
$request->set_accept(MIME_RSS);
$request->set_content_type(MIME_RSS);
- $request->set_body( $graph->to_rdfxml() );
+
+ $data = new SimpleGraph();
+ $data->add_turtle( $graph->to_turtle());
+
+
$data->add_resource_triple( 'tag:
talis.com,2008:moriarty-tmp-augment-channel',
RDF_TYPE, '
http://purl.org/rss/1.0/channel');
+
$data->add_resource_triple( 'tag:
talis.com,2008:moriarty-tmp-augment-channel',
RSS_ITEMS, 'tag:
talis.com,2008:moriarty-tmp-augment-channel-items');
+
$data->add_resource_triple( 'tag:
talis.com,2008:moriarty-tmp-augment-channel-items',
RDF_TYPE, '
http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq');
+ $request->set_body( $data->to_rdfxml() );
return $request->execute();
}
=======================================
--- /trunk/build.xml Wed Feb 23 06:09:01 2011
+++ /trunk/build.xml Fri Jul 29 08:34:10 2011
@@ -1,23 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="Moriarty" default="build">
- <property name="base-dir" value="." />
- <property name="test-dir" value="${base-dir}/tests" />
- <property name="test-results-dir" value="${test-dir}/test_results" />
- <property name="deploy-dir" value="/var/www/html" />
-
- <target name="build" depends="unit-tests" />
-
- <target name="init">
- <mkdir dir="${test-results-dir}" />
- </target>
-
- <target name="unit-tests">
- <echo message="Running moriarty unit tests" />
- <exec dir="${test-dir}" executable="phpunit" failonerror="true">
- <arg line=" runtests" />
- </exec>
- </target>
-
+<property name="base-dir" value
= "/opt/hudson/jobs/moriarty/workspace/trunk" />
+<property name="test-dir" value = "${base-dir}/tests" />
+<property name="test-results-dir" value="${test-dir}/test_results"/>
+<property name="deploy-dir" value="/var/www/html"/>
+
+<target name="unit-tests">
+ <echo message="Running moriarty unit tests"/>
+ <exec dir="${test-dir}" executable="php" failonerror="true" >
+ <arg line="${base-dir}/../tests.php" />
+ </exec>
+</target>
+<target name="build" depends="unit-tests" />
</project>
=======================================
--- /trunk/changeset.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/changeset.class.php Fri Jul 29 08:34:10 2011
@@ -50,6 +50,7 @@
var $_index = array();
function __construct($a = '') {
+ parent::__construct();
$this->a = $a;
/* parse the before and after graphs if necessary*/
foreach(array('before','after', 'before_rdfxml', 'after_rdfxml') as
$rdf){
@@ -234,4 +235,6 @@
}
}
+
+
?>
=======================================
--- /trunk/contentbox.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/contentbox.class.php Fri Jul 29 08:34:10 2011
@@ -222,4 +222,5 @@
*/
var $items;
}
+
?>
=======================================
--- /trunk/curlhttpclient.class.php Wed May 18 14:48:53 2011
+++ /trunk/curlhttpclient.class.php Fri Jul 29 08:34:10 2011
@@ -56,7 +56,6 @@
switch($request->method) {
case 'GET' : break;
case 'POST' : curl_setopt($curl_handle, CURLOPT_POST, 1); break;
- case 'HEAD' : curl_setopt($curl_handle, CURLOPT_NOBODY, 1); break;
default : curl_setopt($curl_handle,
CURLOPT_CUSTOMREQUEST,strtoupper($request->method));
}
@@ -198,4 +197,6 @@
return array($response_code,$response_header_array,$response_body);
}
}
+
+
?>
=======================================
--- /trunk/datatable.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/datatable.class.php Fri Jul 29 08:34:10 2011
@@ -931,4 +931,4 @@
}
}
-?>
+
=======================================
--- /trunk/datatableresult.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/datatableresult.class.php Fri Jul 29 08:34:10 2011
@@ -194,5 +194,6 @@
return $ret;
}
-}
-?>
+
+
+}
=======================================
--- /trunk/etc/phingBootstrap.php Wed Feb 23 06:51:25 2011
+++ /trunk/etc/phingBootstrap.php Fri Jul 29 08:34:10 2011
@@ -13,8 +13,6 @@
require_once MORIARTY_DIR . '/tests/fakehttprequest.class.php';
require_once MORIARTY_DIR . '/tests/fakerequestfactory.class.php';
-error_reporting(E_ALL && ~E_STRICT);
-
ini_set('include_path',
ini_get('include_path')
.PATH_SEPARATOR.MORIARTY_DIR
=======================================
--- /trunk/graph.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/graph.class.php Fri Jul 29 08:34:10 2011
@@ -125,6 +125,31 @@
$request->set_body( $turtle );
return $request->execute();
}
+
+ function
submit_ntriples_in_batches_from_file($filename,$no_of_lines=500,
$stop_on_failure=true) {
+ $responses = array();
+ $pointer = fopen($filename, 'r');
+ $batch = '';
+ $lineCount=0;
+ while($line = fgets($pointer)){
+ $batch.=$line;
+ $lineCount++;
+ if($lineCount==$no_of_lines){
+ $response = $this->submit_turtle($batch);
+ $responses[] = $response;
+ if($response->is_success()===false AND $stop_on_failure){
+ return $responses;
+ } else {
+ $lineCount=0;
+ $batch='';
+ }
+ }
+ }
+ if(!empty($batch)){
+ $responses[]=$this->submit_turtle($batch);
+ }
+ return $responses;
+ }
/**
* Obtain the graph's bounded description of a given resource
@@ -230,6 +255,9 @@
else if ($response->status_code == 412) {
return false;
}
+
+
+
}
}
?>
=======================================
--- /trunk/graphpath.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/graphpath.class.php Fri Jul 29 08:34:10 2011
@@ -1357,4 +1357,4 @@
}
}
}
-?>
+
=======================================
--- /trunk/httpcache.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/httpcache.class.php Fri Jul 29 08:34:10 2011
@@ -70,6 +70,13 @@
$filename = $this->_directory . $id;
return file_exists($filename);
}
+
+
}
+
+
+
+
+
?>
=======================================
--- /trunk/httprequest.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/httprequest.class.php Fri Jul 29 08:34:10 2011
@@ -276,4 +276,5 @@
}
+
?>
=======================================
--- /trunk/httpresponse.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/httpresponse.class.php Fri Jul 29 08:34:10 2011
@@ -60,6 +60,20 @@
return $this->status_code >= 200 && $this->status_code < 300;
}
+
+ /**
+ * Gets the content-type sent with the response, if any
+ * @return string if content-type is set, boolean false otherwise
+ */
+
+ function get_content_type() {
+ foreach($this->headers as $k => $v){
+ if(stristr($k, 'Content-Type')){
+ return $v;
+ }
+ }
+ return false;
+ }
/**
* Obtain a string representation of this response
@@ -172,4 +186,5 @@
}
+
?>
=======================================
--- /trunk/jobqueue.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/jobqueue.class.php Fri Jul 29 08:34:10 2011
@@ -162,4 +162,3 @@
return $response;
}
}
-?>
=======================================
--- /trunk/labeller.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/labeller.class.php Fri Jul 29 08:34:10 2011
@@ -550,4 +550,3 @@
}
}
-?>
=======================================
--- /trunk/moriarty.inc.php Tue Mar 22 04:38:40 2011
+++ /trunk/moriarty.inc.php Fri Jul 29 08:34:10 2011
@@ -142,6 +142,7 @@
define('OWL_SYMMETRICPROPERTY', '
http://www.w3.org/2002/07/owl#SymmetricProperty');
define('OWL_ANNOTATIONPROPERTY', '
http://www.w3.org/2002/07/owl#AnnotationProperty');
define('OWL_DISJOINTWITH', '
http://www.w3.org/2002/07/owl#disjointWith');
+define('OPEN_LASTCACHEDPAGE', '
http://open.vocab.org/terms/lastCachedPage');
define('OUTPUT_TYPE_RDF', 'rdf');
define('OUTPUT_TYPE_XML', 'xml');
@@ -150,4 +151,5 @@
define('OUTPUT_TYPE_HTML', 'html');
define('OUTPUT_TYPE_JSON', 'json');
+
?>
=======================================
--- /trunk/phing.xml Wed Feb 23 06:51:25 2011
+++ /trunk/phing.xml Fri Jul 29 08:34:10 2011
@@ -37,7 +37,6 @@
<!-- no tests yet -->
<exclude name="httpcache.test.php" />
- <exclude name="storegroup.test.php" />
</fileset>
</batchtest>
</phpunit>
@@ -60,7 +59,6 @@
<!-- no tests yet -->
<exclude name="httpcache.test.php" />
- <exclude name="storegroup.test.php" />
</fileset>
</batchtest>
</phpunit>
=======================================
--- /trunk/phphttpclient.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/phphttpclient.class.php Fri Jul 29 08:34:10 2011
@@ -73,10 +73,10 @@
$response->body = $response_body;
$response->info = $response_info;
//ID20100317 $response->request = $request;
- $response->request_method = $request->method;
- $response->request_uri = $request->uri;
- $response->request_headers = $request->headers;
- $response->request_body = $request->body;
+ $response->request_method = $this->method;
+ $response->request_uri = $this->uri;
+ $response->request_headers = $this->headers;
+ $response->request_body = $this->body;
$key = spl_object_hash($request);
$this->responses[$key] = $response;
@@ -90,4 +90,6 @@
return @$this->responses[$key];
}
}
+
+
?>
=======================================
--- /trunk/rollback.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/rollback.class.php Fri Jul 29 08:34:10 2011
@@ -79,4 +79,5 @@
}
}
+
?>
=======================================
--- /trunk/simplegraph.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/simplegraph.class.php Fri Jul 29 08:34:10 2011
@@ -1075,16 +1075,7 @@
}
else {
foreach($base_obs as $base_o){
- // because we want to enforce strict type check
- // on in_array, we need to ensure that array keys
- // are ordered the same
- ksort($base_o);
- $base_p_values = $index[$base_uri][$base_p];
- foreach($base_p_values as &$v)
- {
- ksort($v);
- }
- if(!in_array($base_o, $base_p_values, true)) {
+ if(!in_array($base_o, $index[$base_uri][$base_p])) {
$diff[$base_uri][$base_p][]=$base_o;
}
}
@@ -1372,5 +1363,38 @@
return $values;
}
-}
-?>
+ /** Skolemise Bnodes
+ * replace bnodes in the graph with URIs
+ * @param urispace
+ **/
+
+ public function skolemise_bnodes($urispace)
+ {
+ $bnodes = $this->get_bnodes();
+ $skolemised_bnodes = array();
+ foreach($bnodes as $no => $bnode){
+ $uri = $urispace.'id-'.++$no;
+ $this->replace_resource($bnode, $uri);
+ $skolemised_bnodes[$bnode] = $uri;
+ }
+ return $skolemised_bnodes;
+ }
+
+ public function get_bnodes()
+ {
+ $bnodes = array();
+ $index = $this->get_index();
+ foreach($index as $s => $ps){
+ if(strpos($s,'_:')===0) $bnodes[]=$s;
+ foreach($ps as $p => $os){
+ foreach($os as $o){
+ if($o['type']=='bnode'){
+ $bnodes[]=$o['value'];
+ }
+ }
+ }
+ }
+ return array_unique($bnodes);
+ }
+}
+
=======================================
--- /trunk/snapshots.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/snapshots.class.php Fri Jul 29 08:34:10 2011
@@ -45,4 +45,5 @@
}
}
+
?>
=======================================
--- /trunk/store.class.php Tue Mar 22 04:38:40 2011
+++ /trunk/store.class.php Fri Jul 29 08:34:10 2011
@@ -12,7 +12,7 @@
require_once MORIARTY_DIR. 'augmentservice.class.php';
require_once MORIARTY_DIR. 'oaiservice.class.php';
require_once MORIARTY_DIR. 'httprequest.class.php';
-
+require_once MORIARTY_DIR. 'changeset.class.php';
/**
* Represents a platform store.
*/
@@ -203,6 +203,90 @@
{
return $this->get_contentbox()->save_item($content, $content_type);
}
+
+
+ /**
+ * mirror_from_url
+ *
+ * @return array of responses from http requests, and overall success
status
+ * @author Keith Alexander
+ **/
+ function mirror_from_url($url, $rdf_content=false)
+ {
+
+ $return = array(
+ 'get_page' => false,
+ 'get_copy' => false,
+ 'put_page' => false,
+ 'update_data' => false,
+ 'success' => false,
+ );
+
+ if (empty( $this->request_factory) ) {
+ $this->request_factory = new HttpRequestFactory();
+ }
+
+ $last_cached_page_uri = $this->get_contentbox()->uri.'/mirrors/'.$url;
+
+ if(!$rdf_content){
+
+ $web_page_request = $this->request_factory->make('GET', $url);
+
$web_page_request->set_accept('application/rdf+xml;q=0.8,text/turtle;q=0.9,*/*;q=0.1');
+ $web_page_response = $web_page_request->execute();
+ $return['get_page'] = $web_page_response;
+ $web_page_content = $web_page_response->body;
+ } else {
+ $web_page_content = $rdf_content;
+ $return['rdf_content'] = $rdf_content;
+ }
+ if($rdf_content OR $web_page_response->is_success() ){
+
+ $newGraph = new SimpleGraph();
+ $newGraph->add_rdf($web_page_content);
+ $newGraph->add_resource_triple($url, OPEN_LASTCACHEDPAGE,
$last_cached_page_uri);
+ $newGraph->skolemise_bnodes($last_cached_page_uri.'/');
+ $after = $newGraph->get_index();
+ # get previous copy if it exists
+ $cached_page_request = $this->request_factory->make('GET',
$last_cached_page_uri, $this->credentials);
+ $cached_page_response = $cached_page_request->execute();
+ $return['get_copy'] = $cached_page_response;
+ if($cached_page_response->status_code == '200'){
+ $before = json_decode($cached_page_response->body, true);
+ } else if( $cached_page_response->status_code == '404' ) {
+ $before = false;
+ } else {
+ return $return;
+ }
+ $put_page_request = $this->request_factory->make('PUT',
$last_cached_page_uri, $this->credentials);
+ $put_page_request->set_body($newGraph->to_json());
+ $put_page_request->set_content_type('application/json');
+ $put_page_response = $put_page_request->execute();
+ $return['put_page'] = $put_page_response;
+
+ if(!$put_page_response->is_success()){
+ return $return;
+ }
+ # build new changeset
+
+ $Changeset = new ChangeSet(array('before' => $before, 'after' =>
$after));
+
+ if($Changeset->has_changes()){
+ $return['update_data'] =
$this->get_metabox()->apply_changeset($Changeset);
+ if($return['update_data']->is_success()){
+ $return['success'] = true;
+ }
+ return $return;
+ } else {
+ $return['success'] = true;
+ return $return;
+ }
+
+
+ } else {
+
+ return $return;
+ }
+ }
}
?>
=======================================
--- /trunk/tests/augmentservice.test.php Wed Feb 23 06:55:57 2011
+++ /trunk/tests/augmentservice.test.php Fri Jul 29 08:34:10 2011
@@ -60,5 +60,57 @@
$this->assertTrue( in_array('Content-Type: application/rss+xml',
$fake_request->get_headers() ) );
}
+ function test_augment_graph_creates_rss_channel() {
+ $fake_request_factory = new FakeRequestFactory();
+ $fake_request = new FakeHttpRequest( new HttpResponse() );
+
$fake_request_factory->register('POST', "
http://example.org/store/services/augment",
$fake_request );
+ $ss = new AugmentService("
http://example.org/store/services/augment");
+ $ss->request_factory = $fake_request_factory;
+
+ $response = $ss->augment_graph( new SimpleGraph() );
+
+ $data = new SimpleGraph();
+ $data->from_rdfxml($fake_request->get_body());
+
+ $this->assertTrue(
$data->has_resource_triple('tag:
talis.com,2008:moriarty-tmp-augment-channel',
RDF_TYPE, '
http://purl.org/rss/1.0/channel'));
+
+
+ }
+
+ function test_augment_graph_creates_items_list() {
+ $fake_request_factory = new FakeRequestFactory();
+ $fake_request = new FakeHttpRequest( new HttpResponse() );
+
$fake_request_factory->register('POST', "
http://example.org/store/services/augment",
$fake_request );
+ $ss = new AugmentService("
http://example.org/store/services/augment");
+ $ss->request_factory = $fake_request_factory;
+
+ $response = $ss->augment_graph( new SimpleGraph() );
+
+ $data = new SimpleGraph();
+ $data->from_rdfxml($fake_request->get_body());
+
+ $this->assertTrue(
$data->has_resource_triple('tag:
talis.com,2008:moriarty-tmp-augment-channel',
RSS_ITEMS, 'tag:
talis.com,2008:moriarty-tmp-augment-channel-items'));
+ $this->assertTrue(
$data->has_resource_triple('tag:
talis.com,2008:moriarty-tmp-augment-channel-items',
RDF_TYPE, '
http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq'));
+ }
+
+/*
+ function test_augment_graph_creates_item_for_each_subject_in_graph() {
+ $fake_request_factory = new FakeRequestFactory();
+ $fake_request = new FakeHttpRequest( new HttpResponse() );
+
$fake_request_factory->register('POST', "
http://example.org/store/services/augment",
$fake_request );
+ $ss = new AugmentService("
http://example.org/store/services/augment");
+ $ss->request_factory = $fake_request_factory;
+
+ $g = new SimpleGraph();
+
$g->add_resource_triple('
http://example.org/subj', '
http://example.org/pred', '
http://example.org/obj');
+ $response = $ss->augment_graph( $g );
+
+ $data = new SimpleGraph();
+ $data->from_rdfxml($fake_request->get_body());
+
+ $this->assertTrue(
$data->has_resource_triple('tag:
talis.com,2008:moriarty-tmp-augment-channel-items', '
http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', '
http://example.org/subj'));
+ $this->assertTrue(
$data->has_resource_triple('
http://example.org/subj', '
http://example.org/pred', '
http://example.org/obj'));
+ }
+*/
}
?>
=======================================
--- /trunk/tests/curlhttpclient.test.php Wed May 18 14:48:53 2011
+++ /trunk/tests/curlhttpclient.test.php Fri Jul 29 08:34:10 2011
@@ -40,16 +40,7 @@
$google_response = $client->get_response_for($google_key);
$this->assertEquals('gws', $google_response->headers['server']);
- $this->assertEquals('YTS/1.20.0', $yahoo_response->headers['server']);
- }
-
- function test_send_request_with_head_method()
- {
- $client = new CurlHttpClient();
- $google_request = new HttpRequest('HEAD', '
http://www.google.com/');
- $google_key = $client->send_request($google_request);
- $google_response = $client->get_response_for($google_key);
- $this->assertEquals('gws', $google_response->headers['server']);
+
$this->assertEquals('
http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds',
$yahoo_response->headers['x-xrds-location']);
}
function test_parse_response_parses_all_responses() {
=======================================
--- /trunk/tests/graph.test.php Sun Mar 21 05:36:37 2010
+++ /trunk/tests/graph.test.php Fri Jul 29 08:34:10 2011
@@ -352,6 +352,27 @@
$response = $g->submit_turtle( $this->_turtle_doc );
$this->assertTrue( in_array('Accept: */*',
$fake_request->get_headers() ) );
}
+
+ function test_submit_ntriples_from_file_in_batches(){
+ $response = new HttpResponse('202');
+ $graph = $this->getMock('Graph', array('submit_turtle'),
array(),'',false );
+ $graph->expects($this->exactly(10))
+ ->method('submit_turtle')
+ ->will($this->returnValue($response));
+ $filename = dirname(__FILE__).'/documents/10-ntriples.nt';
+ $result = $graph->submit_ntriples_in_batches_from_file($filename,1);
+ $this->assertEquals(count($result), 10);
+ }
+ function test_submit_ntriples_from_file_in_batches_stop_on_failure(){
+ $response = new HttpResponse('500');
+ $graph = $this->getMock('Graph', array('submit_turtle'),
array(),'',false );
+ $graph->expects($this->exactly(1))
+ ->method('submit_turtle')
+ ->will($this->returnValue($response));
+ $filename = dirname(__FILE__).'/documents/10-ntriples.nt';
+ $result =
$graph->submit_ntriples_in_batches_from_file($filename,1,true);
+ $this->assertEquals(count($result), 1);
+ }
}
=======================================
***Additional files exist in this changeset.***