Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (add deps): add deps to build.gradle #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tobiasschweizer
Copy link
Collaborator

@tobiasschweizer tobiasschweizer commented Jan 31, 2025

This PR provides the basic setup for the RML generator.

@tobiasschweizer
Copy link
Collaborator Author

tobiasschweizer commented Jan 31, 2025

public String testMe() {

		Model model = ModelFactory.createDefaultModel();

		String[] inputFileNames = {"src/test/resources/data/person_json2shacl/crosswalk_content.ttl",
				"src/test/resources/data/person_json2shacl/crosswalk_metadata.ttl",
				"src/test/resources/data/person_json2shacl/source_metadata.ttl",
				"src/test/resources/data/person_json2shacl/source_content.ttl",
				"src/test/resources/data/person_json2shacl/target_metadata.ttl",
				"src/test/resources/data/person_json2shacl/target_content.ttl"
				"src/main/java/fi/csc/mscr/tranformation/rml/test.ttl" // test file with some simple content
		};

                // https://jena.apache.org/tutorials/rdf_api.html#ch-Reading-RDF
		for (String inputFileName : inputFileNames) {

			InputStream in = RDFDataMgr.open(inputFileName);

			if (in == null) {
				throw new IllegalArgumentException("File: " + inputFileName + " not found");
			}

			// read the RDF/XML file
			model.read(in, null, "TTL");

			// write out the Model

		}

		//System.out.println(model);

		Resource test = model.getResource("https://example.com/1");
		Literal prop = test.getProperty(ResourceFactory.createProperty("http://schema.org/name")).getLiteral();

		System.out.println(prop);

		return "test";
	}

test.ttl

PREFIX schema: <http://schema.org/>

<https://example.com/1> a schema:Book ;
    schema:name "test" .

@jkesanie This works for my test file's contents. Can the single test files you provided by loaded like this? I cannot find the definition of the mscr prefix in those files, maybe you could help me here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant