Skip to content

Improper parsing with URIs without # #499

Description

@Alfiva

I want to register a ServiceCallee through the RESTAPI. For this I send the serialized ServiceProfile to the appropriate URL. Then the RESTAPI parses it and registers it in the service bus.

This ServiceProfile works:

@prefix pvn: <http://ontology.universAAL.org/uAAL.owl#> .
@prefix ns: <http://www.daml.org/services/owl-s/1.1/Profile.owl#> .
@prefix ns1: <http://www.daml.org/services/owl-s/1.1/Process.owl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix ns2: <http://www.daml.org/services/owl-s/1.1/Service.owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ns3: <http://ontology.universAAL.org/PhThing.owl#> .
@prefix ns4: <http://ontology.universAAL.org/Device.owl#> .
@prefix : <http://ontology.universAAL.org/Workbench.owl#> .
_:BN000000 ns2:presentedBy <http://demo.inter-iot.eu/presence-sensor1DeviceServer> ;
  a ns:Profile ;
  ns:has_process <http://demo.inter-iot.eu/default.owl#presence-sensor1DeviceServerProcess> ;
  ns:hasResult [
    ns1:withOutput (
      [
        a ns1:OutputBinding ;
        ns1:toParam <http://ontology.universAAL.org/InterIoT.owl#output> ;
        ns1:valueForm """
          @prefix : <http://ontology.universAAL.org/uAAL.owl#> .
          _:BN000000 a :PropertyPath ;
            :thePath (
              <http://ontology.universAAL.org/PhThing.owl#controls>
            ) .
          """^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
      ]
    ) ;
    a ns1:Result
  ] ;
  ns:hasOutput (
    <http://ontology.universAAL.org/InterIoT.owl#output>
  ) .
<http://demo.inter-iot.eu/presence-sensor1> a <http://ontology.universAAL.org/Device.owl#ValueDevice> ,
    ns3:Device ,
    ns3:PhysicalThing .
<http://demo.inter-iot.eu/presence-sensor1DeviceServer> a ns3:DeviceService ;
  pvn:instanceLevelRestrictions (
    [
      owl:hasValue <http://demo.inter-iot.eu/presence-sensor1> ;
      a owl:Restriction ;
      owl:onProperty ns3:controls
    ]
    [
      a owl:Restriction ;
      owl:allValuesFrom <http://ontology.universAAL.org/Device.owl#ValueDevice> ;
      owl:onProperty ns3:controls
    ]
  ) ;
  ns2:presents _:BN000000 ;
  pvn:numberOfValueRestrictions "0"^^xsd:int .
<http://ontology.universAAL.org/InterIoT.owl#output> a ns1:Output ;
  ns1:parameterType "http://ontology.universAAL.org/Device.owl#ValueDevice"^^xsd:anyURI .
<http://ontology.universAAL.org/Device.owl#ValueDevice> a owl:Class .

While this other does not:

@prefix pvn: <http://ontology.universAAL.org/uAAL.owl#> .
@prefix ns: <http://www.daml.org/services/owl-s/1.1/Profile.owl#> .
@prefix ns1: <http://www.daml.org/services/owl-s/1.1/Process.owl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix ns2: <http://www.daml.org/services/owl-s/1.1/Service.owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ns3: <http://ontology.universAAL.org/PhThing.owl#> .
@prefix ns4: <http://ontology.universAAL.org/Device.owl#> .
@prefix : <http://ontology.universAAL.org/Workbench.owl#> .
_:BN000000 ns2:presentedBy <http://demo.inter-iot.eu/presence-sensor1DeviceServer> ;
  a ns:Profile ;
  ns:has_process <http://demo.inter-iot.eu/presence-sensor1DeviceServerProcess> ;
  ns:hasResult [
    ns1:withOutput (
      [
        a ns1:OutputBinding ;
        ns1:toParam <http://ontology.universAAL.org/InterIoT.owl#output> ;
        ns1:valueForm """
          @prefix : <http://ontology.universAAL.org/uAAL.owl#> .
          _:BN000000 a :PropertyPath ;
            :thePath (
              <http://ontology.universAAL.org/PhThing.owl#controls>
            ) .
          """^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
      ]
    ) ;
    a ns1:Result
  ] ;
  ns:hasOutput (
    <http://ontology.universAAL.org/InterIoT.owl#output>
  ) .
<http://demo.inter-iot.eu/presence-sensor1> a <http://ontology.universAAL.org/Device.owl#ValueDevice> ,
    ns3:Device ,
    ns3:PhysicalThing .
<http://demo.inter-iot.eu/presence-sensor1DeviceServer> a ns3:DeviceService ;
  pvn:instanceLevelRestrictions (
    [
      owl:hasValue <http://demo.inter-iot.eu/presence-sensor1> ;
      a owl:Restriction ;
      owl:onProperty ns3:controls
    ]
    [
      a owl:Restriction ;
      owl:allValuesFrom <http://ontology.universAAL.org/Device.owl#ValueDevice> ;
      owl:onProperty ns3:controls
    ]
  ) ;
  ns2:presents _:BN000000 ;
  pvn:numberOfValueRestrictions "0"^^xsd:int .
<http://ontology.universAAL.org/InterIoT.owl#output> a ns1:Output ;
  ns1:parameterType "http://ontology.universAAL.org/Device.owl#ValueDevice"^^xsd:anyURI .
<http://ontology.universAAL.org/Device.owl#ValueDevice> a owl:Class .

It fails with the following error:

Caused by: java.lang.NullPointerException
	at org.universAAL.middleware.service.owls.profile.ServiceProfile.getProcessURI(ServiceProfile.java:448)
	at org.universAAL.middleware.service.impl.ServiceStrategy.addRegParams(ServiceStrategy.java:279)
	at org.universAAL.middleware.service.impl.ServiceBusImpl.addNewServiceProfiles(ServiceBusImpl.java:168)
	at org.universAAL.middleware.service.ServiceCallee.addNewServiceProfiles(ServiceCallee.java:137)
	at org.universAAL.middleware.service.ServiceCallee.addNewServiceProfiles(ServiceCallee.java:110)
	at org.universAAL.middleware.service.ServiceCallee.<init>(ServiceCallee.java:68)

The only difference is in the URI of the #has_process property.
The reason is that, when parsing the second serialized ServiceProfile, the property #has_process is lost. I have checked that this happens if the value of that property does not contain the # character. Therefore, in the first case, with a value: <http://demo.inter-iot.eu/default.owl#presence-sensor1DeviceServerProcess> succeeds. While in the second, a value with <http://demo.inter-iot.eu/presence-sensor1DeviceServerProcess> fails.
I understand there is something wrong with the Turtle serializer, or perhaps I'm missing something else.
The funny thing is that apparently in some previous build it used to work... I have been toying with modifications because of Android, but I have double-checked that all my bundles are back to "master". Can you reproduce the error? Do you have any idea why this would happen in the serializer?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions