Coder Social home page Coder Social logo

opc-ua-nodeset-parser's People

Contributors

coolbeevip avatar kevinherron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

opc-ua-nodeset-parser's Issues

Considering NodeSet2.xml when parsing NodeSet.xml

Just stumbled across this interesting project.
Since the UaNodeSet.parse() only supports one NodeSet.xml as input, what would be the way to go, when there are multiple files at play, i.e. the NodeSet2.xml

Is the UaNodeSetMerger of the so far unreleased version 0.5.0 the tool for that?
If so, ist there some order to consider?

I have just started, getting in touch with OpcUa, so maybe this question is dumb. And I am even unsure whether questions like this are valued here.

About the relationship between custom attributes and UANodeSet Schema objects

I noticed that some objects are defined under the package com.digitalpetri.opcua.nodeset.attributes to wrap the UANodeSet.xsd object

But I did not find a one-to-one mapping relationship

I guess class ObjectNodeAttributes is the wrapping class UAObject, But it is missing the ParentNodeId attribute.

The class Node in UANodeSet.xsd defines the following inheritance relationship

UANode-> UAInstance -> UAObject
UANode-> UAInstance -> UAVariable

This is a great project, but I am a little confused. Will this part continue to improve?

Upgrade to 1.04

As I understand, this lib uses v1.03 of the OPC UA specification. Will there be support for v1.04 in the future and is there a way to contribute?

gNode.getReferences() NPE

Element References attribute minOccurs=0

  <xs:complexType name="UANode">
    <xs:sequence>
      <xs:element name="DisplayName" type="LocalizedText" minOccurs="0" maxOccurs="unbounded"></xs:element>
      <xs:element name="Description" type="LocalizedText" minOccurs="0" maxOccurs="unbounded"></xs:element>
      <xs:element name="Category" type="xs:string" minOccurs="0" maxOccurs="unbounded"></xs:element>
      <xs:element name="Documentation" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
      <xs:element name="References" type="ListOfReferences" minOccurs="0"></xs:element>
      <xs:element name="Extensions" type="ListOfExtensions" minOccurs="0"></xs:element>
    </xs:sequence>
    <xs:attribute name="NodeId" type="NodeId" use="required"></xs:attribute>
    <xs:attribute name="BrowseName" type="QualifiedName" use="required"></xs:attribute>
    <xs:attribute name="WriteMask" type="WriteMask" default="0"></xs:attribute>
    <xs:attribute name="UserWriteMask" type="WriteMask" default="0"></xs:attribute>
    <xs:attribute name="SymbolicName" type="SymbolicName" use="optional"></xs:attribute>
  </xs:complexType>
        // Reference Details
        nodeSet.getUAObjectOrUAVariableOrUAMethod().forEach(gNode -> {
            NodeId sourceNodeId = AttributeUtil.tryParseNodeId(gNode.getNodeId(), aliases);

            gNode.getReferences().getReference().forEach( <------ Need check NPE
                gReference -> {
                    org.eclipse.milo.opcua.sdk.core.Reference reference =
                        referenceFromGenerated(sourceNodeId, gReference);

                    references.put(sourceNodeId, reference);

                    reference.invert(namespaceTable).ifPresent(
                        inverseReference ->
                            implicitReferences.put(inverseReference.getSourceNodeId(), inverseReference)
                    );
                }
            );
        });

org.eclipse.milo:sdk-server:jar:0.4.0-SNAPSHOT is missing

I use mvn clean package build this project with the following error

is milo 0.4.0-SNAPSHOT based on branch dev/0.4?

[WARNING] The POM for org.eclipse.milo:sdk-server:jar:0.4.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.173 s
[INFO] Finished at: 2020-03-15T23:00:38+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project uanodeset-parser: Could not resolve dependencies for project com.digitalpetri.opcua:uanodeset-parser:jar:0.4.0-SNAPSHOT: Could not find artifact org.eclipse.milo:sdk-server:jar:0.4.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

org.xml.sax.SAXParseException Premature end of file

I created an XML file with the following content
NOTE:element value

  <UAVariable NodeId="i=104" BrowseName="DataTypeVersion" ParentNodeId="i=58" DataType="String">
    <Value>0</Value>
  </UAVariable>

I use the method UaNodeSet.parse() to parse it and I get the following error

[Fatal Error] :1:1: Premature end of file。
[main] WARN com.digitalpetri.opcua.nodeset.util.AttributeUtil - unable to parse Value: 
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file。
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
	at org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder.setInput(OpcUaXmlStreamDecoder.java:110)
	at org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder.setInput(OpcUaXmlStreamDecoder.java:106)
	at com.digitalpetri.opcua.nodeset.util.AttributeUtil.parseValue(AttributeUtil.java:126)
	at com.digitalpetri.opcua.nodeset.attributes.VariableNodeAttributes.value(VariableNodeAttributes.java:166)
	at com.digitalpetri.opcua.nodeset.attributes.VariableNodeAttributes.fromGenerated(VariableNodeAttributes.java:130)
	at com.digitalpetri.opcua.nodeset.UaNodeSet.lambda$new$5(UaNodeSet.java:141)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at com.digitalpetri.opcua.nodeset.UaNodeSet.<init>(UaNodeSet.java:119)
	at com.digitalpetri.opcua.nodeset.UaNodeSet.parse(UaNodeSet.java:236)
	at com.digitalpetri.opcua.nodeset.UaNodeSetTest.parse(UaNodeSetTest.java:94)
	at com.digitalpetri.opcua.nodeset.UaNodeSetTest.testParseHollySysNodeSet(UaNodeSetTest.java:88)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Parsed schema/Opc.Ua.NodeSet.Schema.EmptyReferences.xml and generated 2 nodes.

Process finished with exit code 0

This problem can be solved after modifying VariableNodeAttributes.java the following

private static DataValue value(
    UAVariable.Value gValue,
    Marshaller marshaller,
    NodeId nodeId,
    Map<NodeId, String> rawXmlValues
) {
    Optional optional = Optional.ofNullable(gValue).map(UAVariable.Value::getAny);
    if(optional.isPresent()){
        return AttributeUtil.parseValue(gValue.getAny(), marshaller, nodeId, rawXmlValues);
    }else{
        return new DataValue(Variant.NULL_VALUE);
    }
}

Implementation Guidance of using this project with ExampleServer

I am a new to OPC/UA and getting up to speed. We have a project that depends on DI and Robotics. I want to expose both models with the ExampleServer in the MILO's server-examples . I was able to do the folliowing

 @Test
    public void testMerge() throws Exception {
        UaNodeSet roboticsNodeSet = parse("robotics/Opc.Ua.Robotics.NodeSet2.xml");
        UaNodeSet devicesNodeSet = parse("di/Opc.Ua.Di.NodeSet2.xml");
        UaNodeSet mergedNodeSet = UaNodeSetMerger.merge(roboticsNodeSet, devicesNodeSet);
        System.out.println("Merged nodes has "+mergedNodeSet.getNodes().size());
    }

I see that the ExampleServer starts up an ExampleNamespace. If I need to expose the mergedNodeSet which contains 2 namespaces,

  1. Should I be creating two DINamespace and RoboticsNamespace classes which takes in the mergedNodeSet and filters only those nodes relavant for that namespace and add them ?
  2. Also, should I be doing the following code to get the FolderNode for References , DataTypes , ObjectTypes and simply add the nodes from the UANodeSet ?
getServer()
            .getAddressSpaceManager()
            .getManagedNode()

If you can guide with some sample code for the import process, I appreciate that. Thanks in advance for your time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.