Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Rdf.graph([
// common typing & labels
Rdf.triple(
overlayIri, vocabularies.rdf.type, rso.Thing
),
Rdf.triple(
overlayIri, vocabularies.rdf.type, rso.EX_Digital_Image
),
Rdf.triple(
overlayIri, vocabularies.rdf.type, crmdig.D9_Data_Object
),
Rdf.triple(
overlayIri, vocabularies.rdfs.label, Rdf.literal(name)
),
Rdf.triple(
overlayIri, rso.displayLabel, Rdf.literal(name)
),
// derivatives info
Rdf.triple(
topImage, crmdig.L21_used_as_derivation_source, eventIri
),
Rdf.triple(
bottomImage, crmdig.L21_used_as_derivation_source, eventIri
),
Rdf.triple(
eventIri, vocabularies.rdf.type, crmdig.D3_Formal_Derivation
),
Rdf.triple(
eventIri, crmdig.L22_created_derivative, overlayIri
),
// Parameters - param1
Rdf.triple(
),
// 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;
}
private createValue(text: string, language: string): AtomicValue | EmptyValue {
if (text.length === 0) { return FieldValue.empty; }
let datatype = this.props.definition.xsdDatatype || vocabularies.xsd._string;
if (!language && XsdDataTypeValidation.sameXsdDatatype(datatype, vocabularies.rdf.langString)) {
// Replace rdf:langString -> xsd:string if no language specified
datatype = vocabularies.xsd._string;
}
let value: Rdf.Node;
if (language) {
value = Rdf.langLiteral(text, language);
} else if (XsdDataTypeValidation.sameXsdDatatype(datatype, vocabularies.xsd.anyURI)) {
value = Rdf.iri(text);
} else {
value = Rdf.literal(text, datatype);
}
return AtomicValue.set(this.props.value, {value});
}
function createGeoLiteral(coord: Model.Coordinate, config: PatternConfig) {
let value = `${coord.lat}#${coord.long}`;
let dataType: Rdf.Iri;
if (config.kind === 'place') {
if (config.format) {
value =
config.format.replace('lat', coord.lat.toString()).replace('long', coord.long.toString());
}
if (config.datatype) {
dataType = Rdf.iri(config.datatype);
}
}
return Rdf.literal(value, dataType);
}
updateValues(({values, errors}) => {
const newValue: LabeledValue = {value: Rdf.literal(checked)};
let newValues = Immutable.List();
newValues = newValues.push(FieldValue.fromLabeled(newValue));
const validated = handler.validate({values: newValues, errors: errors});
return validated;
});
}
mapped.label = label.map(({value, lang}) =>
lang.length ? Rdf.langLiteral(value.value, lang) : Rdf.literal(value.value)
);
const parameters = params.map(param => ({
displayLabel: Rdf.literal(displayLabel),
imageIri: param.imageIri,
service: Rdf.iri(param.imageServiceUri),
canvasWidth: Rdf.literal(param.canvasSize.width.toString(), xsd.integer),
canvasHeight: Rdf.literal(param.canvasSize.height.toString(), xsd.integer),
label: Rdf.literal(labels.get(param.imageIri)),
}));
return SparqlClient.prepareQuery(sparql, parameters);
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) ));
}
if (order) {
triples.push(Rdf.triple(baseIri, field.order, Rdf.literal(order, xsd._string) ));
}
for (const value of defaultValues) {
triples.push(Rdf.triple(baseIri, field.default_value, Rdf.literal(value, xsd._string)));
}
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 ));
state.matches.forEach((matches, targetIri) => {
const target = Rdf.iri(targetIri);
for (const match of matches) {
const matchPointer = Rdf.bnode();
const matchPredicate = match.kind === AlignKind.ExactMatch
? rso.PX_exact_match : rso.PX_narrow_match;
triples.push(Rdf.triple(match.iri, matchPredicate, matchPointer));
triples.push(Rdf.triple(matchPointer, rso.PX_match_target, target));
match.excluded.forEach(excludedChild => {
triples.push(Rdf.triple(matchPointer, rso.PX_match_excludes, Rdf.iri(excludedChild)));
});
}
});
triples.push(
Rdf.triple(iri, rdf.type, rso.Alignment),
Rdf.triple(iri, rdfs.label, Rdf.literal(state.metadata.label)),
Rdf.triple(iri, rdfs.comment, Rdf.literal(state.metadata.description)),
Rdf.triple(iri, rso.PX_source_terminology, state.metadata.source),
Rdf.triple(iri, rso.PX_target_terminology, state.metadata.target)
);
return Rdf.graph(triples);
}
export function serializeArgument(
newArgumentIri: Rdf.Iri, argument: Argument, beliefs: Array
): Rdf.Graph {
const conclusionTriples =
argument.conclusions.map(
belief => Rdf.triple(Rdf.BASE_IRI, crminf.J2_concluded_that, belief)
);
const baseArgumentGraph =
Rdf.graph([
Rdf.triple(Rdf.BASE_IRI, vocabularies.rdf.type, crminf.I1_Argumentation),
Rdf.triple(Rdf.BASE_IRI, vocabularies.rdfs.label, Rdf.literal(argument.title)),
Rdf.triple(Rdf.BASE_IRI, crm.P3_has_note, Rdf.literal(argument.note)),
...conclusionTriples,
]);
const specificArgumentGraph =
serializeSpecificArgument(argument, beliefs);
return Rdf.union(baseArgumentGraph, specificArgumentGraph);
}