DBus: returning a file descriptor - glib

I want to implement a DBus service that returns a file descriptor, but this error is raised:
** (process:3419): WARNING **: Cannot marshal type "(null)" in variant
** (process:3419): CRITICAL **: unable to append OUT arg of type GValue for create_connection: ((GValue*) 0x647730)
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6fcd5b9 in g_type_check_value ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
The interface I have implemented looks like this:
<node name="/org/designfu/IceService">
<interface name="org.designfu.IceService">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ice_service"/>
<method name="create_connection">
<!-- This is optional, and in this case is redunundant -->
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ice_service_create_connection"/>
<arg type="b" name="controlling_mode" direction="in" />
<arg type="b" name="upnp" direction="in" />
<arg type="s" name="dbus_path" direction="out" />
<arg type="s" name="username_fragment" direction="out" />
<arg type="s" name="password" direction="out" />
<arg type="v(h)" name="send_fd" direction="out" />
<arg type="v(h)" name="recv_fd" direction="out" />
</method>
</interface>
</node>
and this is my implementation:
gboolean ice_service_create_connection(IceService *obj,
const gboolean controlling_mode,
const gboolean upnp,
char **dbus_conn_path,
char **username_fragment,
char **password,
GVariant **send_fd,
GVariant **recv_fd,
GError **error)
{
IceConnection *conn;
gboolean res;
conn = g_object_new(ICE_CONNECTION_TYPE,
"controlling-mode", controlling_mode,
"upnp", upnp,
NULL);
/* register dbus path */
char uuid_str[] = "123";
char dbus_path[512];
g_snprintf(dbus_path, 512, "/org/designfu/IceService/object/%s", uuid_str, NULL);
dbus_g_connection_register_g_object(bus, dbus_path, G_OBJECT(conn));
/* set output parameters */
*dbus_conn_path = g_strdup(dbus_path);
res = ice_connection_get_local_credentials(conn, username_fragment, password);
g_assert(res);
*send_fd = g_variant_new("(h)", conn->their_sock[SEND]);
*recv_fd = g_variant_new("(h)", conn->their_sock[RECV]);
g_assert(*send_fd);
g_assert(*recv_fd);
return TRUE;
}
If I leave out the send_fd and recv_fd output parameters, the functions works like a charm.
However, somehow I have an error in passing the file descriptors to the dbus.
The descriptors were created using
int domain = AF_LOCAL;
int type = SOCK_STREAM;
int protocol = 0;
err = socketpair(domain, type, protocol, sock);
Does anyone have a clue what's wrong here?

v(h) doesn't look like a valid DBus type signature, are you sure you don't mean (h)?

Related

Get all "someValuesFrom" of an object property class with Jena

I want to get all the values of "someValuesFrom" of each Object Property as a list.
I have this part of an owl file:
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeFrame">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasAgent"/>
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasMainAction"/>
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeVerb"/>
</owl:Restriction>
</owl:equivalentClass>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasOptionalPatient"/>
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Beverage"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#BodyPart"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ClosedLocation"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Clothing"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Food"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Furniture"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#NatureElement"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#NaturePhenomenon"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#OpenLocation"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Toy"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Transport"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Vegetal"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
</owl:Class>
I've tried something like this:
OntClass ontClass = this.ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
System.out.println("is restriction");
System.out.println(equiv.getLocalName());
}
}
The quantity of "is restriction" printed on the screen is equal to the length of properties, but getLocalName is always "null".
What do I have to do?
EDIT: I've got the name of property correctly doing some changes in the code (see below).
Now I still can't get the "someValueFrom".
OntClass ontClass = this.ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
System.out.println("is restriction");
System.out.println(equiv.asRestriction().getOnProperty().getLocalName());
}
}
The reason why getLocalName is returning null is because you are using anonymous classes and properties, i.e. classes and properties without assigned URIs. Since Jena cannot find the URI, it returns null.
To illustrate, here is a subset of your ontology with named classes and properties rather than anonymous classes and properties:
<rdf:Description rdf:about="http://www.w3.org/2002/07/owl#topObjectProperty">
<rdfs:range rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#AnimalObjectPerson"/>
</rdf:Description>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#AnimalObjectPerson">
<owl:equivalentClass>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
</owl:unionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeFrame">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasAgent"/>
<owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
</owl:Class>
and here is the code for retrieving the range of the property:
OntClass ontClass = ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
OntProperty ontProperty = equiv.asRestriction().getOnProperty();
OntResource range = ontProperty.getRange();
List<OntClass> rangeList = range.asClass().listEquivalentClasses().toList();
for (OntClass rangeEquiv: rangeList) {;
for (OntClass rangeUnionClass: rangeEquiv.asUnionClass().listOperands().toList()) {
System.out.println("classes in union = " + rangeUnionClass);
}
}
}
}
I hope that helps.
In the provided snippet there is ambiguous situation: the restriction ...#hasMainAction + ...#ErgativeVerb could be either Data or Object Property Existential Quantification Restriction (for more about this see owl2 guide).
There are no explicit declarations in the snippet to judge what it is exaclty.
All Restrictions are anonymous resources (class expressions) - that's why they have no uri and local name therefore.
Jena-API (the package org.apache.jena.ontology) is only for outdated OWL-1, not OWL-2.
But there is a jena-based analogue of org.apache.jena.ontology.OntModel - special for OWL-2: com.github.owlcs.ontapi.jena.model.OntModel.
Although it is not directly related to the original question, it might be more useful in this case.
Here is an example:
String fullOwlAsString = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<rdf:RDF xmlns=\"http://www.semanticweb.org/owlapi/test#\"\n" +
" xml:base=\"http://www.semanticweb.org/owlapi/test\"\n" +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"\n" +
" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n" +
" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">" +
"<owl:Ontology rdf:about=\"#\" />" + yourSnippet + "</rdf:RDF>";
InputStream in = new ByteArrayInputStream(fullOwlAsString.getBytes(StandardCharsets.UTF_8));
OntModel ont = OntManagers.createONT().loadOntologyFromOntologyDocument(in).asGraphModel();
ont.ontObjects(OntClass.ObjectSomeValuesFrom.class).map(x -> x.getValue())
.filter(x -> x.canAs(OntClass.ComponentsCE.class))
.map(x -> (OntClass.ComponentsCE<? extends OntObject>)x.as(OntClass.ComponentsCE.class))
.flatMap(x -> x.getList().members())
.filter(RDFNode::isResource).map(RDFNode::asResource).map(Resource::getLocalName)
.forEach(System.out::println);
And the output:
Animal
Beverage
BodyPart
ClosedLocation
Clothing
Food
Furniture
NatureElement
NaturePhenomenon
OpenLocation
Person
Toy
Transport
Vegetal
Animal
Object
Person

The underlying connection was closed: An unexpected error occurred on a receive (After file upload completed)

In Asp.Net MVC 5
I use this code in a class to upload my file in FTP Server.
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(ftpURL);
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
ftpRequest.Credentials = new NetworkCredential(UserName, Password);
ftpRequest.Timeout = -1;
Stream requestStream = ftpRequest.GetRequestStream();
long fileSize = 0;
Byte[] buffer = new Byte[buferSize];
int bytesRead = file.Read(buffer, 0, buferSize);
fileSize += bytesRead;
while (bytesRead > 0)
{
requestStream.Write(buffer, 0, bytesRead);
bytesRead = file.Read(buffer, 0, buferSize);
fileSize += bytesRead;
}
requestStream.Close();
return fileSize;
and I have this config in web.config because files are too big:
<location path="Programs/Upload">
<system.web>
<httpRuntime executionTimeout="86400" maxRequestLength="2097152" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648"/>
</requestFiltering>
</security>
</system.webServer>
When I try to upload small files (in release mode with debug = 'false') everything work well. but when file size become big I face with this error (after file completely uploaded):
**The underlying connection was closed: An unexpected error occurred on a receive**
The file is completely uploaded and is available in FTP Server!

ROS custom message with sensor_msgs/Image issue with subscriber

I have a custom message -
sensor_msgs/Image im
float32 age
string name
I could successfully write a publisher for this message and it seem to run ok. However, I have an issue with the subscriber.
#include <ros/ros.h>
#include <custom_msg/MyString.h>
#include <custom_msg/MyImage.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/Image.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>
void custom_image_rcvd( const custom_msg::MyImage& msg )
{
ROS_INFO_STREAM( "msg::: Name:"<< msg.name << " Age:"<< msg.age );
cv::Mat im = cv_bridge::toCvShare( msg.im, "bgr8" )->image ;
cv::imshow("viewz", im );
cv::waitKey(30);
}
int main( int argc, char ** argv )
{
ros::init(argc, argv, "custom_subscriber");
ros::NodeHandle nh;
ros::Subscriber sub2 = nh.subscribe( "custom_image", 2, custom_image_rcvd );
ros::spin();
}
When I try to catkin_make this I get the following error.
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/subsc.cpp: In function ‘void custom_image_rcvd(const MyImage&)’:
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/subsc.cpp:22:57: error: no matching function for call to ‘toCvShare(const _im_type&, const char [5])’
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/subsc.cpp:22:57: note: candidates are:
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:198:17: note: cv_bridge::CvImageConstPtr cv_bridge::toCvShare(const Image&, const boost::shared_ptr<const void>&, const string&)
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:198:17: note: no known conversion for argument 2 from ‘const char [5]’ to ‘const boost::shared_ptr<const void>&’
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:171:17: note: cv_bridge::CvImageConstPtr cv_bridge::toCvShare(const ImageConstPtr&, const string&)
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:171:17: note: no known conversion for argument 1 from ‘const _im_type {aka const sensor_msgs::Image_<std::allocator<void> >}’ to ‘const ImageConstPtr& {aka const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&}’
make[2]: *** [custom_msg/CMakeFiles/subscribe.dir/subsc.cpp.o] Error 1
make[1]: *** [custom_msg/CMakeFiles/subscribe.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
What I can make out is that msg.im is of the type _im_type aka. sensor_msgs::Image_<ContainerAllocator>. I cannot seem to understand this part.
How can I retrieve my image correctly from this custom message?
You have to take a closer look on the signature of toCvShare. It can be read from the error message, that this function has two overloads:
cv_bridge::CvImageConstPtr cv_bridge::toCvShare(const Image&, const boost::shared_ptr<const void>&, const string&)
and
cv_bridge::CvImageConstPtr cv_bridge::toCvShare(const ImageConstPtr&, const string&)
So the function either expects an Image plus a pointer to some object (first case) or a ImageConstPtr (second case). You are, however, only passing a Image, so this matches neither of the two options.
If I understand the API documentation correctly, the second argument in the first case is expected to be a pointer to the message that contains the image. Try the following code:
void custom_image_rcvd(const custom_msg::MyImageConstPtr& msg)
{
ROS_INFO_STREAM("msg::: Name:" << msg->name << " Age:" << msg->age);
cv::Mat im = cv_bridge::toCvShare(msg->im, msg, "bgr8")->image;
cv::imshow("viewz", im);
cv::waitKey(30);
}
Note that I changed the call of toCvShare as well as the signature of the callback.

Flex object size are different when I add an ANE

I have a problem when I add an ANE (that I built by myself) to a Flex mobile project.
The problem is that the size of the objects are different than before I add the ANE. I've never used this ANE, I've only added it.
Here is an image before I add the ANE:
And an image after I add the ANE:
As you can see, the size of whole app are different. Do you know which can be the problem?
Thanks in advance
** Update info **
Code on ios:
#import "FlashRuntimeExtensions.h"
FREContext eventContext;
FREObject init(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
{
eventContext = ctx;
NSLog(#"init");
return NULL;
}
void CameraExtContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
{
NSLog(#"camera ext context initializer");
*numFunctionsToTest = 1;
FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * *numFunctionsToTest);
func[0].name = (const uint8_t*) "init";
func[0].functionData = NULL;
func[0].function = &init;
*functionsToSet = func;
}
void CameraExtensionUniversalInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet)
{
NSLog(#"Camera extension initializer");
*extDataToSet = NULL;
*ctxInitializerToSet = &CameraExtContextInitializer;
}
Code of library in AS:
package com.xxx.Controller
{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.events.StatusEvent;
import flash.external.ExtensionContext;
public class ReaderDeviceExtensionController extends EventDispatcher
{
private static var _instance:ReaderDeviceExtensionController;
private var extContext:ExtensionContext;
public function ReaderDeviceExtensionController(enforcer:SingletonEnforcer)
{
super();
extContext = ExtensionContext.createExtensionContext( "com.xxx.Controller", "" );
if ( !extContext ) {
throw new Error( "Reader device native extension is not supported on this platform." );
}
}
public static function get instance():ReaderDeviceExtensionController {
if ( !_instance ) {
_instance = new ReaderDeviceExtensionController( new SingletonEnforcer() );
_instance.init();
}
return _instance;
}
public function dispose():void {
extContext.dispose();
}
private function init():void {
extContext.call( "init" );
}
}
}
class SingletonEnforcer {
}
Extension.xml:
<extension xmlns="http://ns.adobe.com/air/extension/3.1">
<id>com.xxx.Controller</id>
<versionNumber>0.0.1</versionNumber>
<platforms>
<platform name="iPhone-ARM">
<applicationDeployment>
<nativeLibrary>libTestSimpleAne.a</nativeLibrary>
<initializer>CameraExtensionUniversalInitializer</initializer>
</applicationDeployment>
</platform>
</platforms>
</extension>
I build the ANE with the following ADT command:
adt -package -target ane MWCameraNativeExtension.ane extension.xml -swc NativeDevicePluginForCamera.swc -platform iPhone-ARM -C ios .
Code of my application in Flex:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="HTMLMainContent">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label x="346" y="290" fontSize="16" paddingLeft="20" text="HI HI HI"/>
</s:View>
Is this running on an iPad 3? My guess is that you are accidentally unlocking the retina resolution when you use the native extension.
The default iOS SDK that Flash Builder / packager uses is an older version that didn't support the retina resolution of the iPad 3. So when you package an application without a native extension you get the iPad 2 resolution and iOS scales everything. When you use a native extension and you specify a newer iOS SDK it will automatically use the native resolution of the device.
Try tracing out stage.stageWidth and stage.stageHeight with and without the extension included.
Also, check in the Project Properties -> Flex Build Packaging -> Apple iOS -> Native Extensions -> Apple iOS SDK box. If that is populated then you are most likely have the problem I described.

Jena changes my owl file after adding an instance

I have an owl file created with protege 4.2. when I add some Instance with Jena, Jena changes the file structure but the file extension remains the same (.owl) the file is readable in protege with some error. Anyone knows where is the problem with my code?
Because the result of the sparql query is somehow strange after the edit with Jena.
For example, Before editing with Jena
<owl:NamedIndividual rdf:about="&ontologies;thesis_ontology_1try#AM6">
<rdf:type rdf:resource="&ontologies;thesis_ontology_1try#ApplicationModel"/>
<hasID rdf:datatype="&xsd;string">20125157-d62b-45de-8809-84186c7169b5AM6</hasID>
<name rdf:datatype="&xsd;string">Gebäudemodell / Buildingmodel</name>
<hasContent rdf:resource="&ontologies;cpixml"/>
<hasLevelOfDetail rdf:resource="&ontologies;thesis_ontology_1try#4"/>
<hasDomain rdf:resource="&ontologies;thesis_ontology_1try#BIM"/>
<hasType rdf:resource="&ontologies;thesis_ontology_1try#Object"/>
<hasPhase rdf:resource="&ontologies;thesis_ontology_1try#SLCT"/>
<hasContent rdf:resource="&ontologies;thesis_ontology_1try#ifc"/>
</owl:NamedIndividual>
After Jena
<rdf:Description rdf:about="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#AM6">
<hasContent rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/cpixml"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
<hasDomain rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#BIM"/>
<hasType rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#Object"/>
<hasID rdf:datatype="http://www.w3.org/2001/XMLSchema#string">20125157-d62b-45de-8809-84186c7169b5AM6</hasID>
<hasPhase rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#SLCT"/>
<rdf:type rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#ApplicationModel"/>
<hasContent rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#ifc"/>
<name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Gebäudemodell / Buildingmodel</name>
<hasLevelOfDetail rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#4"/>
<rdf:type rdf:nodeID="A28"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdf:type rdf:nodeID="A29"/>
<rdf:type rdf:nodeID="A30"/>
<rdf:type rdf:nodeID="A31"/>
<rdf:type rdf:nodeID="A32"/>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
<rdf:type rdf:nodeID="A33"/>
<rdf:type rdf:nodeID="A34"/>
<rdf:type rdf:nodeID="A12"/>
<rdf:type rdf:nodeID="A15"/>
<rdf:type rdf:nodeID="A35"/>
<rdf:type rdf:nodeID="A5"/>
<Linkedby rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#LM2"/>
<isAMof rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#MMC2"/>
And This is the code
public static void main(String[] args) throws IOException {
InputStream in = FileManager.get().open("./src/thesis_ontology_1try.owl");
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, null);
model.read(in, null);
in.close();
String NS = "http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#";
OntClass ApplicationModel = model.getOntClass(NS + "ApplicationModel");
Individual dom = model.getIndividual(NS + "RFP");
Individual pha = model.getIndividual(NS + "SLCT");
Individual lev = model.getIndividual(NS + "3");
Individual new1 = model.createIndividual(NS + "new1", ApplicationModel);
ObjectProperty domain = model.createObjectProperty(NS +"hasDomain");
ObjectProperty phase = model.createObjectProperty(NS +"hasPhase");
ObjectProperty lod = model.createObjectProperty(NS +"hasLevelOfDetail");
model.add(new1, domain, dom);
model.add(new1, phase, pha);
model.add(new1, lod, lev);
PrintStream p= new PrintStream("./src/thesis_ontology_1try.owl");
model.writeAll(p, "RDF/XML", null);
p.close();
System.out.println("Done");
}
}
model.writeAll(p, "RDF/XML", null);
try "RDF/XML-ABBREV", the pretty printer.
But either way, it's the same triples, written differently, and that's what matters.

Resources