Skip to content

Commit

Permalink
docs: generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximvdw committed Dec 2, 2023
1 parent d85d711 commit 2c78487
Show file tree
Hide file tree
Showing 9 changed files with 653 additions and 118 deletions.
2 changes: 1 addition & 1 deletion 1.0/fidmark.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
dcterms:title "Fiducial Marker Ontology"@en ;
<http://purl.org/vocab/vann/preferredNamespacePrefix> "fidmark" ;
<http://purl.org/vocab/vann/preferredNamespaceUri> "http://purl.org/fidmark/"^^xsd:anyURI ;
skos:example "https://raw.githubusercontent.com/OpenHPS/FidMark/main/examples/virtual_object.ttl"^^xsd:anyURI .
skos:example "https://raw.githubusercontent.com/OpenHPS/FidMark/main/examples/virtual_objects.ttl"^^xsd:anyURI .

#################################################################
# Annotation properties
Expand Down
109 changes: 75 additions & 34 deletions examples/eswc2024_generator/data/virtual_objects.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
@prefix fidmark: <http://purl.org/fidmark/>.

example:marker-1 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.150Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.313Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.150Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.313Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.150Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.313Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -48,7 +48,7 @@ example:marker-1 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
]
];
fidmark:markerIdentifier 21;
fidmark:hasDictionary fidmark:DICT_ARUCO_4X4_250;
fidmark:hasDictionary fidmark:DICT_4X4_250;
fidmark:hasHeight [
a qudt:QuantityValue;
qudt:unit unit:CentiM;
Expand All @@ -59,15 +59,15 @@ example:marker-1 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
qudt:unit unit:CentiM;
qudt:numericValue "4"^^xsd:double
].
fidmark:DICT_ARUCO_4X4_250 a fidmark:MarkerDictionary.
fidmark:DICT_4X4_250 a fidmark:MarkerDictionary.
example:marker-2 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.153Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.316Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.153Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.316Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.153Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.316Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -96,7 +96,7 @@ example:marker-2 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
]
];
fidmark:markerIdentifier 42;
fidmark:hasDictionary fidmark:DICT_ARUCO_4X4_250;
fidmark:hasDictionary fidmark:DICT_4X4_250;
fidmark:hasHeight [
a qudt:QuantityValue;
qudt:unit unit:CentiM;
Expand All @@ -108,13 +108,13 @@ example:marker-2 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
qudt:numericValue "4"^^xsd:double
].
example:marker-3 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.154Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.317Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.154Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.317Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.154Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.317Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -143,7 +143,7 @@ example:marker-3 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
]
];
fidmark:markerIdentifier 63;
fidmark:hasDictionary fidmark:DICT_ARUCO_4X4_250;
fidmark:hasDictionary fidmark:DICT_4X4_250;
fidmark:hasHeight [
a qudt:QuantityValue;
qudt:unit unit:CentiM;
Expand All @@ -155,13 +155,13 @@ example:marker-3 a fidmark:ArUco, sosa:FeatureOfInterest, ogc:SpatialObject;
qudt:numericValue "4"^^xsd:double
].
example:marker-4 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.318Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.318Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.318Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -201,13 +201,13 @@ example:marker-4 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
qudt:numericValue "5"^^xsd:double
].
example:marker-5 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.155Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -247,13 +247,13 @@ example:marker-5 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
qudt:numericValue "5"^^xsd:double
].
example:marker-6 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
dcmi:created "2023-12-02T15:16:39.156Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:hasPosition [
a poso:AbsolutePosition;
dcmi:created "2023-12-02T15:16:39.156Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:hasOrientation [
a poso:Orientation;
dcmi:created "2023-12-02T15:16:39.156Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.319Z"^^xsd:dateTime;
poso:yaw 26.772757919197186;
poso:pitch 20.097627797692653;
poso:roll 11.831161447369514;
Expand Down Expand Up @@ -292,11 +292,32 @@ example:marker-6 a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:ARTag;
qudt:unit unit:CentiM;
qudt:numericValue "5"^^xsd:double
].
example:marker-hiro a sosa:FeatureOfInterest, ogc:SpatialObject, fidmark:FiducialMarker;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
fidmark:hasHeight [
a qudt:QuantityValue;
qudt:unit unit:CentiM;
qudt:numericValue "5"^^xsd:double
];
fidmark:hasWidth [
a qudt:QuantityValue;
qudt:unit unit:CentiM;
qudt:numericValue "5"^^xsd:double
];
fidmark:hasImageDesciptor [
a fidmark:ImageDescriptor;
fidmark:asImage "https://arprojectsdemo.netlify.app/markers/hiro.png"^^xsd:anyURI;
fidmark:asPATT "https://arprojectsdemo.netlify.app/data/hiro.patt"^^xsd:anyURI
].
example:virtualobject-1 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.156Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.156Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-1
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand All @@ -315,10 +336,14 @@ example:virtualobject-1 a sosa:FeatureOfInterest, ogc:SpatialObject;
poso:isRelativeTo example:marker-1
].
example:virtualobject-2 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-2
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand All @@ -337,10 +362,14 @@ example:virtualobject-2 a sosa:FeatureOfInterest, ogc:SpatialObject;
poso:isRelativeTo example:marker-2
].
example:virtualobject-3 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-3
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.320Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand All @@ -359,10 +388,14 @@ example:virtualobject-3 a sosa:FeatureOfInterest, ogc:SpatialObject;
poso:isRelativeTo example:marker-3
].
example:virtualobject-4 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-4
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand All @@ -381,10 +414,14 @@ example:virtualobject-4 a sosa:FeatureOfInterest, ogc:SpatialObject;
poso:isRelativeTo example:marker-4
].
example:virtualobject-5 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-5
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand All @@ -403,10 +440,14 @@ example:virtualobject-5 a sosa:FeatureOfInterest, ogc:SpatialObject;
poso:isRelativeTo example:marker-5
].
example:virtualobject-6 a sosa:FeatureOfInterest, ogc:SpatialObject;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:hasPosition [
a poso:RelativePosition;
dcmi:created "2023-12-02T15:16:39.157Z"^^xsd:dateTime;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:isRelativeTo example:marker-6
], [
a poso:RelativePosition;
dcmi:created "2023-12-02T16:12:03.321Z"^^xsd:dateTime;
poso:xAxisValue [
a qudt:QuantityValue;
qudt:unit unit:M;
Expand Down
8 changes: 4 additions & 4 deletions examples/eswc2024_generator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/eswc2024_generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@openhps/core": "^0.6.4",
"@openhps/core": "^0.6.5",
"@openhps/rdf": "^0.4.28",
"axios": "^1.6.2",
"ts-node": "^10.9.1"
Expand Down
30 changes: 24 additions & 6 deletions examples/eswc2024_generator/src/generator.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Quad, RDFSerializer, Store } from "@openhps/rdf";
import { ARTagMarker, ArUcoMarker, FiducialMarker, MarkerDictionary, VirtualObject } from "./models";
import { DICT_ARUCO_4X4_250 } from "./ontologies/fidmark";
import { Absolute3DPosition, AngleUnit, GeographicalPosition, LengthUnit, Orientation, Relative3DPosition, RelativeOrientation } from "@openhps/core";
import * as fs from 'fs';
import * as path from 'path';
import { ImageDescriptor } from "./models/ImageDescriptor";
import { fidmark } from "./ontologies";
import { QRCodeMarker } from "./models/markers/QRCodeMarker";

const URI = "http://example.org/markers/";

Expand All @@ -16,7 +17,7 @@ function createArUco(): Quad[] {
marker.identifier = i * 21;
marker.height = 4;
marker.width = 4;
marker.dictionary = MarkerDictionary.fromURI(DICT_ARUCO_4X4_250);
marker.dictionary = MarkerDictionary.fromURI(fidmark.DICT_4X4_250);
marker.setPosition(new Absolute3DPosition(i * 19, i * 10, 0, LengthUnit.METER));
marker.position.setOrientation(Orientation.fromEuler({
yaw: 31,
Expand Down Expand Up @@ -70,28 +71,45 @@ function createVirtualObjects(): Quad[] {
for (let i = 1 ; i < 7 ; i++) {
const object = new VirtualObject();
object.uid = `virtualobject-${i}`;
//object.addRelativePosition(new RelativeOrientation(`marker-${i}`, 1, 1, 1, 1))
object.addRelativePosition(new RelativeOrientation(`marker-${i}`, Orientation.fromEuler({
yaw: 31,
roll: 20,
pitch: 12,
unit: AngleUnit.DEGREE
})))
object.addRelativePosition(new Relative3DPosition(`marker-${i}`, 0, 0, 0, LengthUnit.METER));
const quads = RDFSerializer.serializeToQuads(object, URI);
store.addQuads(quads);
}
return store.getQuads(undefined, undefined, undefined, undefined);
}

function createQRCode(): Quad[] {
const store = new Store();
const marker = new QRCodeMarker();
marker.uid = `marker-qrcode`;
marker.height = 3;
marker.width = 3;
marker.data = "https://2024.eswc-conferences.org/";
marker.setPosition(new GeographicalPosition(35.307364, 25.369789, 20));
const quads = RDFSerializer.serializeToQuads(marker, URI);
store.addQuads(quads);
return store.getQuads(undefined, undefined, undefined, undefined);
}

async function generate() {
const store = new Store();
store.addQuads(createArUco());
store.addQuads(createARTag());
store.addQuads(createCustomMarker());
store.addQuads(createVirtualObjects());
const data = await RDFSerializer.stringify(store, {
fs.writeFileSync(path.join("./data", "virtual_objects.ttl"), await RDFSerializer.stringify(store, {
prettyPrint: true,
prefixes: {
example: URI,
fidmark: "http://purl.org/fidmark/"
}
});
fs.writeFileSync(path.join("./data", "virtual_objects.ttl"), data);
}));
}

generate();
2 changes: 1 addition & 1 deletion examples/eswc2024_generator/src/models/ImageDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ImageDescriptor {

@SerializableMember({
rdf: {
predicate: fidmark.asNFT,
predicate: fidmark.asPATT,
datatype: xsd.anyURI
}
})
Expand Down
Loading

0 comments on commit 2c78487

Please sign in to comment.