Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eventIri, vocabularies.rdf.type, crmdig.D3_Formal_Derivation
),
Rdf.triple(
eventIri, crmdig.L22_created_derivative, overlayIri
),
// Parameters - param1
Rdf.triple(
eventIri, crmdig.L13_used_parameters, param1
),
Rdf.triple(
param1, vocabularies.rdf.type, crmdig.D1_Digital_Object
),
Rdf.triple(
param1, rso.OverlayImageSource, bottomImage
),
Rdf.triple(
param1, rso.OverlayOrder, Rdf.literal('1')
),
Rdf.triple(
param1, rso.OverlayOpacity, Rdf.literal('' + bottomOpacity)
),
// Parameters - param2
Rdf.triple(
eventIri, crmdig.L13_used_parameters, param2
),
Rdf.triple(
param2, vocabularies.rdf.type, crmdig.D1_Digital_Object
),
Rdf.triple(
param2, rso.OverlayImageSource, topImage
),
Rdf.triple(
// empty IRI will be resolved in LDP later through baseIRI
const baseIri = Rdf.iri('');
/*
* create field, basic information
*/
triples.push(Rdf.triple(baseIri, rdf.type, field.Field ));
label.forEach(lbl => triples.push(Rdf.triple(baseIri, rdfs.label, lbl)));
if (description && description.length > 0) {
triples.push(Rdf.triple(baseIri, rdfs.comment, Rdf.literal(description, xsd._string) ));
}
/*
* adding triples for insert pattern
*/
const bInsert = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.insert_pattern, bInsert ));
triples.push(Rdf.triple(bInsert, rdf.type, sp.Query ));
triples.push(Rdf.triple(bInsert, sp.text, Rdf.literal(insertPattern, xsd._string) ));
for (const value of domain) {
triples.push(Rdf.triple(baseIri, field.domain, Rdf.iri(value)));
}
if (xsdDatatype) {
triples.push(Rdf.triple(baseIri, field.xsd_datatype, Rdf.iri(xsdDatatype) ));
}
for (const value of range) {
triples.push(Rdf.triple(baseIri, field.range, Rdf.iri(value)));
}
if (min) {
triples.push(Rdf.triple(baseIri, field.min_occurs, Rdf.literal(min, xsd._string) ));
}
if (max) {
triples.push(Rdf.triple(baseIri, field.max_occurs, Rdf.literal(max, xsd._string) ));
}
param1, rso.OverlayOpacity, Rdf.literal('' + bottomOpacity)
),
// Parameters - param2
Rdf.triple(
eventIri, crmdig.L13_used_parameters, param2
),
Rdf.triple(
param2, vocabularies.rdf.type, crmdig.D1_Digital_Object
),
Rdf.triple(
param2, rso.OverlayImageSource, topImage
),
Rdf.triple(
param2, rso.OverlayOrder, Rdf.literal('2')
),
Rdf.triple(
param2, rso.OverlayOpacity, Rdf.literal('' + topOpacity)
),
]);
return resourceGraph;
}
const bSelect = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.select_pattern, bSelect ));
triples.push(Rdf.triple(bSelect, rdf.type, sp.Query ));
triples.push(Rdf.triple(bSelect, sp.text, Rdf.literal(selectPattern, xsd._string) ));
}
if (askPattern && askPattern.length > 0) {
const bAsk = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.ask_pattern, bAsk ));
triples.push(Rdf.triple(bAsk, rdf.type, sp.Query ));
triples.push(Rdf.triple(bAsk, sp.text, Rdf.literal(askPattern, xsd._string) ));
}
if (deletePattern && deletePattern.length > 0) {
const bDelete = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.delete_pattern, bDelete ));
triples.push(Rdf.triple(bDelete, rdf.type, sp.Query ));
triples.push(Rdf.triple(bDelete, sp.text, Rdf.literal(deletePattern, xsd._string) ));
}
if (valueSetPattern && valueSetPattern.length > 0) {
const bValueset = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.valueset_pattern, bValueset ));
triples.push(Rdf.triple(bValueset, rdf.type, sp.Query ));
triples.push(Rdf.triple(bValueset, sp.text, Rdf.literal(valueSetPattern, xsd._string) ));
}
if (autosuggestionPattern && autosuggestionPattern.length > 0) {
const bAuto = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.autosuggestion_pattern, bAuto ));
triples.push(Rdf.triple(bAuto, rdf.type, sp.Query ));
triples.push(Rdf.triple(bAuto, sp.text, Rdf.literal(autosuggestionPattern, xsd._string) ));
}
if (testSubject) {
triples.push(Rdf.triple(baseIri, field.testsubject, Rdf.iri(testSubject) ));
}
export function serializeObservation(observation: Observation): Rdf.Graph {
const observationTimePg = createObservationTimeSpan(observation);
return Rdf.graph([
Rdf.triple(Rdf.BASE_IRI, vocabularies.rdf.type, crmsci.S19_Encounter_Event),
Rdf.triple(Rdf.BASE_IRI, vocabularies.rdf.type, crmsci.S4_Observation),
Rdf.triple(Rdf.BASE_IRI, crmsci.O21_has_found_at, observation.place),
Rdf.triple(Rdf.BASE_IRI, crm.P4_has_time_span, observationTimePg.pointer),
...observationTimePg.graph.triples.toJS(),
]);
}
if (categories && !isEmpty(categories)) {
forEach(
categories,
category => triples.push(Rdf.triple(baseIri, field.category, category))
);
}
if (selectPattern && selectPattern.length > 0) {
const bSelect = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.select_pattern, bSelect ));
triples.push(Rdf.triple(bSelect, rdf.type, sp.Query ));
triples.push(Rdf.triple(bSelect, sp.text, Rdf.literal(selectPattern, xsd._string) ));
}
if (askPattern && askPattern.length > 0) {
const bAsk = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.ask_pattern, bAsk ));
triples.push(Rdf.triple(bAsk, rdf.type, sp.Query ));
triples.push(Rdf.triple(bAsk, sp.text, Rdf.literal(askPattern, xsd._string) ));
}
if (deletePattern && deletePattern.length > 0) {
const bDelete = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.delete_pattern, bDelete ));
triples.push(Rdf.triple(bDelete, rdf.type, sp.Query ));
triples.push(Rdf.triple(bDelete, sp.text, Rdf.literal(deletePattern, xsd._string) ));
}
if (valueSetPattern && valueSetPattern.length > 0) {
const bValueset = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.valueset_pattern, bValueset ));
triples.push(Rdf.triple(bValueset, rdf.type, sp.Query ));
triples.push(Rdf.triple(bValueset, sp.text, Rdf.literal(valueSetPattern, xsd._string) ));
}
if (autosuggestionPattern && autosuggestionPattern.length > 0) {
const bAuto = Rdf.bnode();
function serializePropSet(belief: Belief, proposition: PropositionSet): Rdf.Graph {
const propositionSetIri = Rdf.iri('');
return Rdf.graph([
Rdf.triple(propositionSetIri, vocabularies.rdf.type, crminf.I4_Proposition_Set),
Rdf.triple(propositionSetIri, vocabularies.rdfs.label, Rdf.literal('Proposition Set')),
...proposition,
]);
}
if (selectPattern && selectPattern.length > 0) {
const bSelect = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.select_pattern, bSelect ));
triples.push(Rdf.triple(bSelect, rdf.type, sp.Query ));
triples.push(Rdf.triple(bSelect, sp.text, Rdf.literal(selectPattern, xsd._string) ));
}
if (askPattern && askPattern.length > 0) {
const bAsk = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.ask_pattern, bAsk ));
triples.push(Rdf.triple(bAsk, rdf.type, sp.Query ));
triples.push(Rdf.triple(bAsk, sp.text, Rdf.literal(askPattern, xsd._string) ));
}
if (deletePattern && deletePattern.length > 0) {
const bDelete = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.delete_pattern, bDelete ));
triples.push(Rdf.triple(bDelete, rdf.type, sp.Query ));
triples.push(Rdf.triple(bDelete, sp.text, Rdf.literal(deletePattern, xsd._string) ));
}
if (valueSetPattern && valueSetPattern.length > 0) {
const bValueset = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.valueset_pattern, bValueset ));
triples.push(Rdf.triple(bValueset, rdf.type, sp.Query ));
triples.push(Rdf.triple(bValueset, sp.text, Rdf.literal(valueSetPattern, xsd._string) ));
}
if (autosuggestionPattern && autosuggestionPattern.length > 0) {
const bAuto = Rdf.bnode();
triples.push(Rdf.triple(baseIri, field.autosuggestion_pattern, bAuto ));
triples.push(Rdf.triple(bAuto, rdf.type, sp.Query ));
triples.push(Rdf.triple(bAuto, sp.text, Rdf.literal(autosuggestionPattern, xsd._string) ));
}
if (testSubject) {
triples.push(Rdf.triple(baseIri, field.testsubject, Rdf.iri(testSubject) ));
Rdf.triple(beliefIri, vocabularies.rdfs.label, Rdf.literal(label))
];
if (belief.beliefType === AssertedBeliefTypeKind) {
triples.push(
Rdf.triple(beliefIri, rso.PX_asserts_value, belief.targetValue),
Rdf.triple(beliefIri, rso.PX_is_canonical_value, Rdf.literal(belief.isCanonical))
);
} else {
if (belief.argumentBeliefType === ArgumentsBeliefTypeAssertionKind) {
triples.push(
Rdf.triple(beliefIri, rso.PX_premise_assertion, belief.assertion)
);
} else {
triples.push(
Rdf.triple(beliefIri, rso.PX_premise_target, belief.target),
Rdf.triple(beliefIri, rso.PX_premise_field, Rdf.iri(belief.field.iri)),
Rdf.triple(beliefIri, rso.PX_premise_target_repository, Rdf.literal(belief.originRepository))
);
}
}
return Rdf.pg(beliefIri, Rdf.graph(triples));
};
belief => Rdf.pg(belief, Rdf.graph([
Rdf.triple(belief, rso.PX_premise_assertion, assertionIri),
]))
)