private void populateDescription(Individual<?,?> individual, Describable describable) { if(describable.label()!=null) { individual.addValue(vocabularyTerm(RDFS.LABEL),literal(describable.label())); } if(describable.comment()!=null) { individual.addValue(vocabularyTerm(RDFS.COMMENT),literal(describable.comment())); } }
private void populateHttpRequestIndividual(HttpRequest request) { requestInd().addValue(vocabularyTerm(RDF.TYPE), externalIndividual(httpTerm("Request"))); requestInd().addValue(httpTerm("methodName"),literal(request.method().toString())); requestInd().addValue(httpTerm("mthd"),externalIndividual(methodsTerm(request.method().toString()))); requestInd().addValue(httpTerm("absolutePath"),literal(request.absolutePath())); String protocolVersion="1.1"; if(!ProtocolVersion.HTTP_1_1.equals(request.protocolVersion())) { protocolVersion="1.0"; requestInd().addValue(httpTerm("httpVersion"),literal(protocolVersion)); requestInd().addValue(dctTerm("date"),literal(clientDate)); current.addValue(vocabularyTerm(RDF.FIRST),headerInd); headerInd.addValue(vocabularyTerm(RDF.TYPE),headerType(header)); headerInd.addValue(httpTerm("fieldName"),literal(header.name())); headerInd.addValue(httpTerm("fieldValue"),literal(header.rawValue())); headerInd.addValue(httpTerm("hdrName"),externalIndividual(headersTerm(header.name()))); i++; bodyInd.addValue(vocabularyTerm(RDF.TYPE),externalIndividual(cntTerm("ContentAsText"))); bodyInd.addValue(cntTerm("characterEncoding"),literal("UTF-8")); bodyInd.addValue(cntTerm("chars"),literal(body));
private void populateConstraintReportIndividual() { Constraints constraints = this.report.getConstraints(); LOGGER.debug("Populating constraints: {}",constraints); reportInd().addValue(vocabularyTerm(RDF.TYPE), externalIndividual(ldp4jTerm("ConstraintReport"))); reportInd().addValue(ldp4jTerm("failureId"), literal(this.report.id().failureId())); reportInd().addValue(ldp4jTerm("failureDate"), literal(this.report.getDate())); reportInd().addValue(ldp4jTerm("failureRequest"), requestInd()); IndividualTranslator translator = new IndividualTranslator(); ShapeIndividualCache shapeCache=new ShapeIndividualCache(); Queue<Shape> pendingShapes=Lists.newLinkedList(constraints.shapes()); while(!pendingShapes.isEmpty()) { Shape shape=pendingShapes.poll(); if(!shapeCache.isPopulated(shape)) { shapeCache.populate(shape); Set<Shape> foundShapes = populateShapeDefinition(shape, shapeCache, translator); pendingShapes.addAll(foundShapes); } } for(URI type:constraints.types()) { Individual<?,?> typeInd=externalIndividual(type); typeInd.addValue(shaclTerm("typeShape"), shapeCache.individual(constraints.typeShape(type))); } for(Individual<?, ?> node:constraints.nodes(dataset)) { Individual<?, ?> individual = translator.translate(node); individual.addValue(shaclTerm("nodeShape"), shapeCache.individual(constraints.nodeShape(node))); } }