8000 Only first JSON object of stream gets mapped · Issue #37 · carml/carml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Only first JSON object of stream gets mapped #37
Open
@pheyvaer

Description

@pheyvaer

Hi,

I'm trying to run the following mapping on a stream.

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ex: <http://example.com/>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix carml: <http://carml.taxonic.com/carml/> .

<#SubjectMapping> a rr:TriplesMap;
        rml:logicalSource [
                rml:source [
                        a carml:Stream;
                        carml:streamName "input";
                ];
                rml:referenceFormulation ql:JSONPath;
                rml:iterator "$"
        ];

        rr:subjectMap [
                rr:template "http://example.com/Child/{id}";
                rr:class ex:Child
        ];

        rr:predicateObjectMap [
                rr:predicate ex:loves;
                rr:objectMap [
                        rml:reference "name";
                ]
].

I send the following JSON objects (3 in this example) separately to a socket on localhost:5005.

{"id":"test", "name":"John"}
{"id":"tests"}
{"id":"tests"}

In my Java code I do the following;

 try {
            Set<TriplesMap> mapping =
                    RmlMappingLoader
                            .build()
                            .load(Paths.get(args[0]), RDFFormat.TURTLE);

            RmlMapper mapper = RmlMapper.newBuilder().build();
            Socket echoSocket = new Socket("localhost", 5005);
            mapper.bindInputStream("input", echoSocket.getInputStream());

            Model result = mapper.map(mapping);

            for (Statement statement: result) {
                System.out.println(statement);
            }

        } catch (Exception e){
            System.out.println(e);
        }

In the model I see that only the first JSON object is mapped. However, the 2 following ones are not. Do you have any idea why this happens?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0