Date: Thu, 28 Mar 2024 05:28:01 -0400 (EDT) Message-ID: <929564064.27326.1711618081048@lyrasis1-roc-mp1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_27325_1390254740.1711618081048" ------=_Part_27325_1390254740.1711618081048 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This document will walk you through getting the code, building the webap= p, and exercising the REST API.
Fedora requires Java 8 and Maven 3 (only for building the project). Chec= k that you have them installed before proceeding:
$ java = -version java version "1.8.0_73" Java(TM) SE Runtime Environment (build 1.8.0_73-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode) $ mvn -version Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T10= :41:47-06:00) Maven home: /Users/kford1/Programs/apache-maven-3.3.9 Java version: 1.8.0_73, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/= jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
You can download pre-compiled binaries= and ru= n Fedora in an existing Tomcat or Jetty instance or pre-packaged Jetty = instances, or build Fedora from source (it's not difficult or time consumin= g).
Clone the latest code from Github:
$ git c= lone https://github.com/fcrepo4/fcrepo4.git Cloning into 'fc4'... remote: Counting objects: 40152, done. remote: Compressing objects: 100% (12759/12759), done. Receiving objects: 14% (5622/40152), 3.68 MiB | 912 KiB/s =20 [...] $ cd fcrepo4
And build the pro= ject (the first time you build Fedora may take some time and bandwidth to d= ownload all the development dependencies):
$ MAVEN= _OPTS=3D"-Xmx1024m -XX:MaxPermSize=3D256m" mvn clean install [INFO] Scanning for projects... [INFO] --------------------------------------------------------------------= ---- [INFO] Reactor Build Order: [INFO]=20 [INFO] Fedora Commons 4 :: Parent POM [INFO] Fedora Commons 4 [INFO] Fedora Repository BOM [INFO] Fedora Repository JCR BOM [INFO] Fedora Repository BOMs [INFO] Fedora Repository Kernel API [INFO] Fedora Repository Configurations Module [INFO] Fedora Repository Kernel Implementation (ModeShape) [INFO] Fedora Event Serialization [INFO] Fedora Repository JMS Module [INFO] Fedora Repository HTTP Commons Module [INFO] Fedora Repository Authorization Commons Module [INFO] Fedora Repository HTTP API Module [INFO] Fedora Repository WebAC Authorization Module [INFO] Fedora Repository Deployable Web Application [INFO] Fedora Repository LDP integration tests Module [INFO] Fedora Repository RDF integration tests Module [INFO] = =20 [INFO] --------------------------------------------------------------------= ---- [INFO] Building Fedora Commons 4 :: Parent POM 5.0.0-SNAPSHOT [INFO] --------------------------------------------------------------------= ---- [INFO]=20 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ fcrepo --- [INFO] Deleting /Volumes/TempStorage/fedora4/fcrepo4/target [INFO]=20 [INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ fcrepo --- [INFO]=20 [INFO] --- maven-enforcer-plugin:1.2:enforce (default) @ fcrepo --- [INFO]=20 [INFO] --- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (pre-unit-t= est) @ fcrepo --- [....]
The webapp can be run from a bundled instance of jetty. The application =
will listen on port 8080 by default.
If you would like to run the webapp on a different port, you can add the "=
jetty.port" option in your maven command (e.g. mvn -Djetty.port=3D8=
181 jetty:run)
$ cd fc= repo-webapp $ MAVEN_OPTS=3D"-Xmx512m" mvn jetty:run [...] TRACE 10:50:43.845 (SessionProvider) Returning new InjectableSession... DEBUG 10:50:43.845 (InjectableSession) Initializing an InjectableSession wi= th SessionFactory org.fcrepo.session.SessionFactory@5a3c8525. TRACE 10:50:43.846 (SessionProvider) Returning new InjectableSession... DEBUG 10:50:43.846 (InjectableSession) Initializing an InjectableSession wi= th SessionFactory org.fcrepo.session.SessionFactory@5a3c8525. 2013-07-01 10:50:44.027:INFO:oejs.AbstractConnector:Started SelectChannelCo= nnector@0.0.0.0:8080 [INFO] Started Jetty Server [INFO] Starting scanner at interval of 2 seconds.
There's a nice, f=
riendly HTML interface waiting for you at http://localhost:8080/rest/ (the default username =
and password is fedoraAdmin)
The REST API documentatio= n provides a full listing of the features and functions of the REST API= . Here are some examples to get you started:
$ curl = "http://localhost:8080/rest/" -ufedoraAdmin:fedoraAdmin @prefix premis: <http://www.loc.gov/premis/rdf/v1#> . @prefix test: <info:fedora/test/> . @prefix memento: <http://mementoweb.org/ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix webac: <http://fedora.info/definitions/v4/webac#> . @prefix acl: <http://www.w3.org/ns/auth/acl#> . @prefix ns001: <http://localhost:8080/rest/ktest/> . @prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> . @prefix xmlns: <http://www.w3.org/2000/xmlns/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix fedora: <http://fedora.info/definitions/v4/repository#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore= #> . @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix xs: <http://www.w3.org/2001/XMLSchema> . @prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . <http://localhost:8080/rest/> fedora:lastModified "2018-05-30T20:51:11.833Z"^^<http= ://www.w3.org/2001/XMLSchema#dateTime> ; rdf:type ldp:RDFSource ; rdf:type ldp:Container ; rdf:type ldp:BasicContainer ; fedora:writable true ; rdf:type fedora:RepositoryRoot ; rdf:type fedora:Resource ; rdf:type fedora:Container ; ldp:contains <http://localhost:8080/rest/ktest= > ; ldp:contains <http://localhost:8080/rest/91/86= /4c/e0/91864ce0-9ad2-49cd-b2c3-85b0c6b204e5> ; ldp:contains <http://localhost:8080/rest/examp= les> ; ldp:contains <http://localhost:8080/rest/t1>= ; ; fedora:hasTransactionProvider <http://localhost:8080/rest/fcr:t= x> .
The REST API supports a variety of RDF serialization formats, including:=
$ curl = http://localhost:8080/rest/ -H "Accept: application/rdf+xml" -ufedoraAdmin:= fedoraAdmin <rdf:RDF xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:acl=3D"http://www.w3.org/ns/auth/acl#" xmlns:ldp=3D"http://www.w3.org/ns/ldp#" xmlns:xs=3D"http://www.w3.org/2001/XMLSchema" xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#" xmlns:webac=3D"http://fedora.info/definitions/v4/webac#" xmlns:ns001=3D"http://localhost:8080/rest/ktest/" xmlns:dc=3D"http://purl.org/dc/elements/1.1/" xmlns:ebucore=3D"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#= " xmlns:premis=3D"http://www.loc.gov/premis/rdf/v1#" xmlns:test=3D"info:fedora/test/" xmlns:fedora=3D"http://fedora.info/definitions/v4/repository#" xmlns:memento=3D"http://mementoweb.org/ns#" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:foaf=3D"http://xmlns.com/foaf/0.1/" xmlns:fedoraconfig=3D"http://fedora.info/definitions/v4/config#" >= =20 <rdf:Description rdf:about=3D"http://localhost:8080/rest/"> <rdf:type rdf:resource=3D"http://fedora.info/definitions/v4/reposito= ry#Resource"/> <ldp:contains rdf:resource=3D"http://localhost:8080/rest/examples"/&= gt; <ldp:contains rdf:resource=3D"http://localhost:8080/rest/91/86/4c/e0= /91864ce0-9ad2-49cd-b2c3-85b0c6b204e5"/> <fedora:hasTransactionProvider rdf:resource=3D"http://localhost:8080= /rest/fcr:tx"/> <ldp:contains rdf:resource=3D"http://localhost:8080/rest/ktest"/> <fedora:lastModified rdf:datatype=3D"http://www.w3.org/2001/XMLSchem= a#dateTime">2018-05-30T20:51:11.833Z</fedora:lastModified> <fedora:writable rdf:datatype=3D"http://www.w3.org/2001/XMLSchema#bo= olean">true</fedora:writable> <rdf:type rdf:resource=3D"http://www.w3.org/ns/ldp#RDFSource"/> <rdf:type rdf:resource=3D"http://fedora.info/definitions/v4/reposito= ry#RepositoryRoot"/> <rdf:type rdf:resource=3D"http://www.w3.org/ns/ldp#Container"/> <ldp:contains rdf:resource=3D"http://localhost:8080/rest/t1"/> <rdf:type rdf:resource=3D"http://fedora.info/definitions/v4/reposito= ry#Container"/> <rdf:type rdf:resource=3D"http://www.w3.org/ns/ldp#BasicContainer"/&= gt; </rdf:Description> </rdf:RDF>
or
$ curl = http://localhost:8080/rest/ -H "Accept: application/n-triples" -ufedoraAdmi= n:fedoraAdmin <http://localhost:8080/rest/> <http://fedora.info/definitions/v4/r= epository#lastModified> "2018-05-30T20:51:11.833Z"^^<http://www.w3.or= g/2001/XMLSchema#dateTime> . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://www.w3.org/ns/ldp#RDFSource> . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://www.w3.org/ns/ldp#Container> . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://www.w3.org/ns/ldp#BasicContainer> . <http://localhost:8080/rest/> <http://fedora.info/definitions/v4/r= epository#writable> "true"^^<http://www.w3.org/2001/XMLSchema#boolean= > . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://fedora.info/definitions/v4/repository#Repositor= yRoot> . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://fedora.info/definitions/v4/repository#Resource&= gt; . <http://localhost:8080/rest/> <http://www.w3.org/1999/02/22-rdf-sy= ntax-ns#type> <http://fedora.info/definitions/v4/repository#Container= > . <http://localhost:8080/rest/> <http://www.w3.org/ns/ldp#contains&g= t; <http://localhost:8080/rest/ktest> . <http://localhost:8080/rest/> <http://www.w3.org/ns/ldp#contains&g= t; <http://localhost:8080/rest/91/86/4c/e0/91864ce0-9ad2-49cd-b2c3-85b0c= 6b204e5> . <http://localhost:8080/rest/> <http://www.w3.org/ns/ldp#contains&g= t; <http://localhost:8080/rest/examples> . <http://localhost:8080/rest/> <http://www.w3.org/ns/ldp#contains&g= t; <http://localhost:8080/rest/t1> . <http://localhost:8080/rest/> <http://fedora.info/definitions/v4/r= epository#hasTransactionProvider> <http://localhost:8080/rest/fcr:tx&= gt; .
$ curl = http://localhost:8080/rest/ -X POST -v -ufedoraAdmin:fedoraAdmin * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) * Server auth using Basic with user 'fedoraAdmin' > POST /rest/ HTTP/1.1 > Host: localhost:8080 > Authorization: Basic ZmVkb3JhQWRtaW46ZmVkb3JhQWRtaW4=3D > User-Agent: curl/7.60.0 > Accept: */* >=20 < HTTP/1.1 201 Created < Date: Thu, 02 Aug 2018 14:50:46 GMT < Set-Cookie: JSESSIONID=3D1aftnonavsnvk1q6ln4jtleda4;Path=3D/ < Expires: Thu, 01 Jan 1970 00:00:00 GMT < Set-Cookie: rememberMe=3DdeleteMe; Path=3D/; Max-Age=3D0; Expires=3DWe= d, 01-Aug-2018 14:50:46 GMT < ETag: W/"187414816f9004f45508769998bec981ca90bea4" < Last-Modified: Thu, 02 Aug 2018 14:50:46 GMT < Link: <http://localhost:8080/static/constraints/ContainerConstraint= s.rdf>; rel=3D"http://www.w3.org/ns/ldp#constrainedBy" < Link: <http://localhost:8080/rest/39965e35-4cad-4b96-b826-0c8612f77= 3d5/fcr:acl>; rel=3D"acl" < Location: http://localhost:8080/rest/39965e35-4cad-4b96-b826-0c8612f77= 3d5 < Content-Type: text/plain < Content-Length: 63 < Server: Jetty(9.3.1.v20150714) <=20 * Connection #0 to host localhost left intact http://localhost:8080/rest/39965e35-4cad-4b96-b826-0c8612f773d5 $ curl http://localhost:8080/rest/7f/50/8e/82/7f508e82-15f7-48de-92a3-2575a= 1b749cf -ufedoraAdmin:fedoraAdmin @prefix premis: <http://www.loc.gov/premis/rdf/v1#> . @prefix test: <info:fedora/test/> . @prefix memento: <http://mementoweb.org/ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix webac: <http://fedora.info/definitions/v4/webac#> . @prefix acl: <http://www.w3.org/ns/auth/acl#> . @prefix ns001: <http://localhost:8080/rest/ktest/> . @prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> . @prefix xmlns: <http://www.w3.org/2000/xmlns/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix fedora: <http://fedora.info/definitions/v4/repository#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore= #> . @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix xs: <http://www.w3.org/2001/XMLSchema> . @prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . <http://localhost:8080/rest/39965e35-4cad-4b96-b826-0c8612f773d5> rdf:type fedora:Container ; rdf:type fedora:Resource ; rdf:type ldp:BasicContainer ; fedora:lastModifiedBy "fedoraAdmin" ; fedora:createdBy "fedoraAdmin" ; fedora:created "2018-08-02T14:50:46.121Z"^^<http://www.w= 3.org/2001/XMLSchema#dateTime> ; fedora:lastModified "2018-08-02T14:50:46.121Z"^^<http://www.w= 3.org/2001/XMLSchema#dateTime> ; rdf:type ldp:RDFSource ; rdf:type ldp:Container ; fedora:writable true .
$ curl = -X DELETE http://localhost:8080/rest/39965e35-4cad-4b96-b826-0c8612f773d5 -= ufedoraAdmin:fedoraAdmin