Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
ew.levr.db.skyrepo.5.15.1.source-code.skyrepo.rs2 Maven / Gradle / Ivy
// Copyright 2015-2016 Eduworks Corporation and other contributing parties.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
context=#add(a="@",b="context");
querySplit=#split(obj="@urlRemainder",split="/");
//If one segment, is id.
//If two segments, is either type/id or id/version. Test using ToLong() on segment 2.
//If three segments, is type/id/version.
query=#object(
type=#split(obj="@urlRemainder",split="/").getIndex(index="1"),
id=#split(obj="@urlRemainder",split="/").getIndex(index="2"),
version=#split(obj="@urlRemainder",split="/").getIndex(index="3")
);
query=#if(
operator=querySplit.count(),
operand="3",
eq=#if(
operator=querySplit.getIndex(index="2").toLong().catch(runtime="NAN").toString(),
operand=querySplit.getIndex(index="2"),
eq=#object(
id=querySplit.getIndex(index="1"),
version=querySplit.getIndex(index="2")
),
ne=#object(
type=querySplit.getIndex(index="1"),
id=querySplit.getIndex(index="2")
)
),
ne=query
);
query=#if(
operator=querySplit.count(),
operand="2",
eq=#object(
id=querySplit.getIndex(index="1")
),
ne=query
);
#queryParse = query;
postData=#fileFromDatastream(name="data");
postObject=postData.fileToString().toObject();
postArray=postData.fileToString().toArray();
get=#skyrepoGet(
type=query.cget(type=""),
id=query.cget(id=""),
version=query.cget(version="")
);
postProcessGet=#toObject(obj="@obj");
postProcessGet=#if(operator="@context", operand="",
eq=postProcessGet,
ne=postProcessGet.jsonLdExpand(
).getIndex(index="0").put(
_key=#type(),
_value=#toArray(obj="@type")
).toArray().jsonLdCompact(
context=#if(
operator="@coercionContext",
operand="",
eq="@context",
ne="@coercionContext"
)
).put(
_key=#context(),
_value="@context"
)
);
tryFormatOutput=#if(operator="@expand", operand="true",
eq=postProcessGet.jsonLdExpand().displayJson(_collapse="true"),
ne=postProcessGet.displayJson(_collapse="true")
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="text/turtle"),operand="true",
eq=postProcessGet.jsonLdToTurtle(context=postProcessGet.getByParam(param=context)).toString(),
ne=#if(operator=#headers().get(accept="").has(has="text/turtle"),operand="true",
eq=postProcessGet.jsonLdToTurtle(context=postProcessGet.getByParam(param=context)).toString(),
ne=tryFormatOutput
)
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="application/x-turtle"),operand="true",
eq=postProcessGet.jsonLdToTurtle(context=postProcessGet.getByParam(param=context)).toString(),
ne=#if(operator=#headers().get(accept="").has(has="application/x-turtle"),operand="true",
eq=postProcessGet.jsonLdToTurtle(context=postProcessGet.getByParam(param=context)).toString(),
ne=tryFormatOutput
)
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="application/rdf+xml"),operand="true",
eq=postProcessGet.jsonLdToRdfXml(context=postProcessGet.getByParam(param=context)).toString(),
ne=#if(operator=#headers().get(accept="").has(has="application/rdf+xml"),operand="true",
eq=postProcessGet.jsonLdToRdfXml(context=postProcessGet.getByParam(param=context)),
ne=tryFormatOutput
)
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="application/rdf+json"),operand="true",
eq=postProcessGet.jsonLdToRdfJson(context=postProcessGet.getByParam(param=context)).displayJson(_collapse="true"),
ne=#if(operator=#headers().get(accept="").has(has="application/rdf+json"),operand="true",
eq=postProcessGet.jsonLdToRdfJson(context=postProcessGet.getByParam(param=context)).displayJson(_collapse="true"),
ne=tryFormatOutput
)
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="application/rdf+n4"),operand="true",
eq=postProcessGet.jsonLdToNQuads(context=postProcessGet.getByParam(param=context)).toString(),
ne=#if(operator=#headers().get(accept="").has(has="application/rdf+n4"),operand="true",
eq=postProcessGet.jsonLdToNQuads(context=postProcessGet.getByParam(param=context)).toString(),
ne=tryFormatOutput
)
);
tryFormatOutput=#if(operator=#headers().get(Accept="").has(has="text/n4"),operand="true",
eq=postProcessGet.jsonLdToNQuads(context=postProcessGet.getByParam(param=context)).toString(),
ne=#if(operator=#headers().get(accept="").has(has="text/n4"),operand="true",
eq=postProcessGet.jsonLdToNQuads(context=postProcessGet.getByParam(param=context)).toString(),
ne=tryFormatOutput
)
);
#tryFormatOutput=tryFormatOutput;
get=#if(
operator=#toObject(obj="@get").count(),
operand="0",
eq=#error(code="404",msg="Object not found or you did not supply sufficient permissions to access the object."),
ne=#toObject(obj="@get"),
).call(get=get).tryFormatOutput();
get=#object(
a=#beforeGet(),
b=get
).get(b="");
beforeGet=#false();
#beforeGet=beforeGet;
save=postObject.skyrepoPut(
type=query.cget(type=""),
id=query.cget(id=""),
version=query.cget(version="")
);
save=#object(
a=save,
b=#afterSave()
).get(a="");
afterSave=#false();
#afterSave=afterSave;
delete=#skyrepoDelete(
type=query.cget(type=""),
id=query.cget(id=""),
version=query.cget(version="")
);
delete=#object(
a=delete,
b=#afterSave()
).get(a="");
saveOrGet=#if(
operator=postData,
operand="",
eq=get,
ne=save
);
deleteOrOther = #if(
operator="@methodType",
operand="DELETE",
eq=delete,
ne=saveOrGet
);
searchOrOther = #if(
operator="@q",
operand="",
eq=deleteOrOther,
ne=#skyRepoSearch()
);
postSearchOrOther = #if(
operator=#fileFromDatastream(name="searchParams"),
operand="",
eq=searchOrOther,
ne=#skyRepoSearch()
);
data=postSearchOrOther;
/data=data;
multiGet=postArray.cforEach(paramName="urlRemainder",op=get.toObject().catch(runtime=#object().get(a="")),rethrow="false",array="true").displayJson(_collapse="true");
/sky/repo/multiGet=multiGet;
searchParamData = #fileFromDatastream(name="searchParams");
searchParamObj = searchParamData.fileToString().toObject();
search=#skyrepoSearch(
q=#if(
operator="@q",
operand="",
eq=#if(
operator=postData.fileToString(),
operand="",
eq="",
ne=postData.fileToString()
),
ne="@q"
),
size=#if(operator="@size", operand="",
eq="50",
ne="@size"
).ccall(
size=#if(operator="@size",operand="",eq=searchParamObj.cget(size=""),ne="@size")
),
start=#if(operator="@start", operand="",
eq="0",
ne="@start"
).ccall(
start=#if(operator="@start",operand="",eq=searchParamObj.cget(start=""),ne="@start")
),
ownership=#if(operator="@ownership", operand="",
eq="all",
ne="@ownership"
).ccall(
ownership=#if(operator="@ownership",operand="",eq=searchParamObj.cget(ownership=""),ne="@ownership")
),
types=searchParamObj.cget(types=""),
sort=#if(operator="@sort",operand="",eq=searchParamObj.cget(sort=""),ne="@sort"),
track_scores=searchParamObj.cget(track_scores="")
);
#skyRepoSearch = search;
//Deprecated
/sky/repo/search = search;
types = #skyrepoTypes();
/sky/repo/types=types;
admin = #skyrepoAdminList().displayJson(_collapse="true");
/sky/admin = admin;